This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/WL1837MOD: hciattach Initialization timed out. Inspite the TIInit_11.8.32.bts being present the initialization is failing

Part Number: WL1837MOD

Tool/software: Linux

Hello,

I am trying to bring up the bluetooth module in wl18xx on a custom xilinx board. wifi works ok.

I enable the bluetooth gpio and I confirmed it on the scope as well. I have the correct RTS and CTS setup also. I can bring up the bluetooth chip with noflow(RTS/CTS disabled) with this command

hciattach /dev/ttyPS1 any 115200 noflow

I see the device addr after  hciconfig hci0 up

But I am unable to bring up the bluetooth with the below command. I picked the TIInit_11.8.32.bts from the latest Bluetooth service pack.

root@plnx_arm:~# hciattach /dev/ttyPS1 texas 115200
Found a Texas Instruments' chip!
Firmware file : /lib/firmware/ti-connectivity/TIInit_11.8.32.bts
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
Initialization timed out.

I also saw this post which has the same sympotoms but I still get the initialization error.

Can you please advise on what I might be missing ? if I am using the correct file for the bluetooth firmware. I am attaching the file I am using for your reference, changed the .bts extension to .txt for attachmentTIInit_11.8.32 (copy).txt

Thanks in advance,

SB

  • Hi,

    sb2017VH said:

    hciattach /dev/ttyPS1 any 115200 noflow

    I see the device addr after  hciconfig hci0 up

    But I am unable to bring up the bluetooth with the below command. I picked the TIInit_11.8.32.bts from the latest Bluetooth service pack.

    root@plnx_arm:~# hciattach /dev/ttyPS1 texas 115200
    Found a Texas Instruments' chip!
    Firmware file : /lib/firmware/ti-connectivity/TIInit_11.8.32.bts
    Loaded BTS script version 1
    texas: changing baud rate to 3000000, flow control to 1
    Initialization timed out.

    please use the following command instead:

    hciattach /dev/ttyPS1 texas 3000000

    sb2017VH said:
    I enable the bluetooth gpio and I confirmed it on the scope as well.

    In that case, please make sure that the ttyPS1 is the correct UART port for the HCI connection and it is configured correctly in the device tree.

    Best regards,

    Vihang

  • Hi Vihang,
    Thanks for your reply. I used the above command but get the same error.
    hciattach /dev/ttyPS1 texas 3000000
    Found a Texas Instruments' chip!
    Firmware file : /lib/firmware/ti-connectivity/TIInit_11.8.32.bts
    Loaded BTS script version 1
    texas: changing baud rate to 3000000, flow control to 1
    Initialization timed out.

    Also I am using the correct UART post for bluetooth since I verified the connection. Can you please point me to the latest .bts file I should be using ? The device tree for UART looks like this
    serial@e0000000 {
    compatible = "xlnx,xuartps", "cdns,uart-r1p8";
    status = "okay";
    clocks = <0x1 0x17 0x1 0x28>;
    clock-names = "uart_clk", "pclk";
    reg = <0xe0000000 0x1000>;
    interrupts = <0x0 0x1b 0x4>;
    device_type = "serial";
    port-number = <0x1>;
    };

    Thanks for your help,
    Surabhi
  • Surabhi,

    You can find the latest WL18xx BT service-pack (bts file) at the following link.
    www.ti.com/.../wl18xx-bt-sp


    Best regards,
    Vihang
  • Hi Vihang,
    I tried the bts file from the above location but i still get the same error.
    I had a question that does the UART need to support 3000000 Mbps baudrate ? The UART I have on the device has the maximum limit to 921600 baudrate. is this the reason why it does not work ?

    I used the stty -F /dev/ttyPS1 115200 and it worked ok but when I set the baurate to 3000000 using the same command it gives me an error.
    Thanks alot for your help,
    Surabhi
  • Can you please let me know your comments.
    Thanks,
    Surabhi
  • sb2017VH said:
    I had a question that does the UART need to support 3000000 Mbps baudrate ?

    The first command (HCI_VS_Update_UART_HCI_Baudrate 0xFF36) in the WL18xx service-pack (bts file) changes the UART baud rate to 3000000. So the MPU needs to be able to support the 3000000 baud rate if the default bts file is used.

    sb2017VH said:
    The UART I have on the device has the maximum limit to 921600 baudrate. is this the reason why it does not work ?

    This could be the root cause of this problem. You can open the bts file in the HCITester (User's Guide) and change the first command from 3000000 to a lower baud rate, for example 921600.

    From:

    # Change UART baudrate
    Send_HCI_VS_Update_Uart_HCI_Baudrate 0xFF36, 0x002dc6c0
    Wait_HCI_Command_Complete_VS_Update_Uart_HCI_Baudrate_Event 5000, 0x00, 0xff36, 0x00
    
    Com_SetParams 3000000, 1

    To:

    # Change UART baudrate
    Send_HCI_VS_Update_Uart_HCI_Baudrate 0xFF36, 0x00e1000
    Wait_HCI_Command_Complete_VS_Update_Uart_HCI_Baudrate_Event 5000, 0x00, 0xff36, 0x00
    
    Com_SetParams 921600, 1

    You can save this modified bts file and use that in your project. Please see if that solves the issue.

    BR,

    Vihang

  • Thanks, will try the above and let you know.
  • Hi Vihang.,
    I understand that the HCI uART connections need to be connected to serial to USb connector. is that correct ? because then we will have to remove the current connections and make new connections. If its not too much of trouble and possible , do u have a low baudrate or less than 921600 baudrate firmware, can you please share that ? I want to first be sure that is the problem before removing connections in the hardware.
    Thanks for your understanding and time.
    Surabhi
  • As, vihang mentioned earlier you can change the 'switching' of the baud rate in BTS file yourself with the HCI tester file and save the BTS file.. Please check below -
    www.ti.com/.../swru136b.pdf

    In addition, i suggest you find out the supported UART baudrates on your custom platform and try it accordingly..

    Thanks
  • The supported baud rate on the UART am using is 1Mbps. I am sure of that. for the HCI tester tool, I will have to remove the hardware connections to the HCI UART lines and connect the serial to USB connecter to it. It will involve hardware changes, thats why I was wondering if I can get a bts file for 921600 baudrate, if it is already available. I will make the connections and change the bts file.
  • Hi Vihang and Hari,
    I changes the bts file to support 921600 using the hci tester tool. The bluetooth chip comes up successfully and I can see it scanning my phone. Thanks for your help. Now that the baudrate is set to 921600 i am thinking what are the limitations of this baudrate ? We are not looking to stream audio but want to use it for discovering and pairing the device. May be transfer a few kB of data.
    Let me know your thoughts.
    Thanks in advance.
    Surabhi
  • Hi,

    sb2017VH said:
    Now that the baudrate is set to 921600 i am thinking what are the limitations of this baudrate ? We are not looking to stream audio but want to use it for discovering and pairing the device. May be transfer a few kB of data.

    I do not think the 921600 baud rate will introduce any bottleneck in terms of performance for such application. Just to put it in perspective, a typical audio stream has ~328 Kbits/s data-rate. So 921600 is plenty for a single audio stream as well.

    Best regards,

    Vihang

  • Thanks. is there a documentation on how to setup the device name? I dont see my device discoverable on my phone or laptop.
    Thanks,
    Surabhi
  • Surabhi,

    sb2017VH said:
    is there a documentation on how to setup the device name? I dont see my device discoverable on my phone or laptop.

    This is a BlueZ stack related question, nothing TI specific. So you will be able to find the relevant details in BlueZ documentation. Additionally, you can use the open source BlueZ/Linux forums if you have questions regarding this open source stack.

    BR,

    Vihang

  • Thank you for your help. I can discover my device on android phones and tablets but cannot discover the device on Iphone or ios devices. If I pair maanually from my side then it works but it does not show up by itself on IOS  when i enable discovering on my device.

    If you have any pointers, please let me know. I will check the bluez stack forums.

    Best Regards,

    Surabhi

  • I have a question if I can port Bluetopia stack for bluetooth on my device. How do I find out if it will be supported ?
    Thanks,
    Surabhi
  • Surabhi,

    sb2017VH said:
    I have a question if I can port Bluetopia stack for bluetooth on my device. How do I find out if it will be supported ?

    The TI dual-mode Bluetooth stack for Linux works in user space. So porting it to your platform should be fairly simple as long as the static binaries in the stack are compatible with your toolchain.

    To get started, you can refer to the following guide.

    You will need to change the tty and gpio values in the bt-en.sh according to your platform.

    Best regards,

    Vihang

  • Hi Vihang,
    I am trying to build the bluetopia with my toolchain and kernel by modifying the setup-bt and toochain-def.mak. I am using a zynq platform and xilinx petalinux setup.
    I have build ti build_utilittied before for wifi and have worked ok but having issues building this now. I get this error
    ../BluetopiaPM//ss1btpm/server/BTPMSRVR.c:16:19: fatal error: stdio.h: No such file or directory
    compilation terminated.
    proj/plat-rules.mak:8: recipe for target 'obj/BTPMSRVR_S.o' failed
    which I believe is because of incorrect setup. Please see my setup-bt and toolchain files. let me know your comments.
    ########################################################################
    # The following section must be updated per local configuration
    ########################################################################
    # Path to local toolchain installation
    export TOOLCHAIN_PATH=/xxxxxx/xilinx/XSDK201604/SDK/2016.4/gnu/

    # Path to SDK compiled kernel
    export KERNEL_PATH=/xxxxxxxxxtmp/work/plnx_arm-xilinx-linux-gnueabi/linux-xlnx/4.6-xilinx+gitAUTOINC+2762bc9163-r0

    ########################################################################
    # The following defintions should not be updated
    ########################################################################
    # Path to root directory of Bluetopia Core
    export BLUETOPIA_CORE_PATH=../BluetopiaPM/Bluetopia

    # Path to root directory of BluetopiaPM Core
    export BLUETOPIA_PM_CORE_PATH=../BluetopiaPM/

    # PROJ_DIR Must (!!!) kept empty
    export PROJ_DIR=

    # output (distribution root)
    export OUT_DIR=..



    toolchain-def.mak
    ###########################################################################################################
    # AM335x sdk8 Defintions - this section should be updated based on SDK installation path
    ###########################################################################################################
    KERNELDIR=$(KERNEL_PATH)/
    TOOLCHAIN_PATH_NATIVE=$(TOOLCHAIN_PATH)/aarch32/lin/
    TOOLCHAIN_PATH_TARGET=$(TOOLCHAIN_PATH)/gcc-arm-linux-gnueabi
    TOOLCHAIN_PREFIX=arm-linux-gnueabihf
    ARCH=arm

    ###########################################################################################################
    # Following section should be filled for non TI SDKs only
    ###########################################################################################################
    # Follwoing are defs for AM335x
    CFLAGS+=-march=armv7-a -marm -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=$(TOOLCHAIN_PATH_TARGET) -I$(TOOLCHAIN_PATH_TARGET)/include

    LDFLAGS+=-lpthread -lm -lrt --sysroot=$(TOOLCHAIN_PATH_TARGET)


    ###########################################################################################################
    # Following section should not be updated
    ###########################################################################################################
    CC=$(TOOLCHAIN_PREFIX)-gcc
    AS=$(TOOLCHAIN_PREFIX)-as
    LD=$(TOOLCHAIN_PREFIX)-ld
    GDB=$(TOOLCHAIN_PREFIX)-gdb
    STRIP=$(TOOLCHAIN_PREFIX)-strip
    RANLIB=$(TOOLCHAIN_PREFIX)-ranlib
    OBJCOPY=$(TOOLCHAIN_PREFIX)-objcopy
    OBJDUMP=$(TOOLCHAIN_PREFIX)-objdump
    AR=$(TOOLCHAIN_PREFIX)-ar
    NM=$(TOOLCHAIN_PREFIX)-nm

    # The following should apply for gstreamer plugin
    CONFIGURE_FLAGS=--target=arm-linux-gnueabihf --host=arm-linux-gnueabihf --build=i686-linux --with-libtool-sysroot=$(TOOLCHAIN_PATH_TARGET)

    PKG_CONFIG_SYSROOT_DIR=$(TOOLCHAIN_PATH_TARGET)
    PKG_CONFIG_PATH=$(TOOLCHAIN_PATH_TARGET)/usr/lib/pkgconfig
    PKG_CONFIG_ALLOW_SYSTEM_LIBS=1


    GLOBCFLAG=S$(CFLAGS)
    GLOBLDFLAGS=$(LDFLAGS)

    CROSS_COMPILE=$(TOOLCHAIN_PREFIX)-

    PATH:=$(TOOLCHAIN_PATH_NATIVE)/bin:$(PATH)

    Thanks,
    Surabhi
  • It is likely, your tool chain is not set correctly.. This is for ARM core with Hard floating point right? Did, you try using the binaries from the SDK directly?

    Thanks
  • Thanks for your reply. Yes, looks like something is not set correctly. Yes it is Hard floating point. please see the below
    arm-linux-gnueabihf-gcc -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -Wl,--hash-style=gnu
    I tried to use the prebuilt binaries but they are complaining about the libasound.so, not found. I dont have this lib? Can you provide this lib so that I can test the pre built binaries.
  • or how can I get libasound.so in my rootfs. not sure what should I enable to get it.
  • It seems, after loading the BTS file, the controller is told to change to 3000000 baud, where as the host moved to 115.2 K baud.. Did, you try with host also configured to 3M, like below -

    hciattach /dev/ttyPS1 texas 3000000

    If, host can't support this baud rate. Use, HCI tester to open the BTS file and change the baudrate to 115.2K baud..

    www.ti.com/.../swru136b.pdf


    Thanks
  • I am able to run the prebuilt apps from my platform. I included the alsa plugin and tht took care of the libasound.a. In particular I want to ran the LinuxGAT_SRV app and was able to connect the android ble scanner app and read and write to the device which is running the GATT server.
    I have a few questions which I wanted to clarify:
    1. For my use case, I was thinking of using GAT server for being able to read and write a few values. I want to use the BLE GAT server to send the battery status and a few other data to app. Do you think GAT server would be sufficient for this ? I could use a custom characteristic for custom data.
    2. Secondly, now that I can run the prebuilt apps I am going to incorporate the function calls from the LinuxGAT_SRV.c file in my code. I want to know what is the main use iof SS1BTPM ? since we initliaze that first.
    Any documentation or comments will be helpful.
    Thanks in advance !
    SB
  • Since, the original intent of the question/query is resolved, I suggest to close this thread and open another one so the thread content is relevant to the query..