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.

Bluetooth, unable to read chip version.

Hi, i am using wl1273 chip with freescale imx6 sabre based custom board. During bluetooth enable, ti-st driver fails to read the chip version and hence reports firmware download error. Ldisc installs succesfully.

I am also able to see the correct response fron chip when verbose is enabled. But there is a line break between the hex codes and that seems to be the problem. Any ideas what may be wrong.

  • Hi,

    I think the problem is probably that the flow control on the UART driver needs to be enabled. I certainly saw a similar failure mode with WL18xx on imx6. In dts file define UART with flow control as highlighted.

    &uart4 {

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_uart4_1>;

    status = "okay";

    fsl,uart-has-rtscts;      // enable rts/cts usage on uart4

    };

  • Here is the log:

    [ 53.778053] (hci_tty): inside hci_tty_open (d72a6130, d2c90140)
    [ 53.784192] (stc): st_register(4)
    [ 53.787668] (stc): chnl_id list empty :4
    [ 53.791790] (stk) : st_kim_start
    [ 53.909975] (stk) :ldisc_install = 1
    [ 53.915072] (stc): st_tty_open
    [ 53.918518] (stk) :line discipline installed
    [ 53.922760] <out<01 01 10 00
    [ 53.926859] >in>04
    [ 53.929021] >in>0e 0c 01 01 10 00 06 00 00 06 0d 00 0f 1f
    [ 53.929227] (stk) :TIInit_0.0.0.bts
    [ 53.938133] (stk) :unknown packet
    [ 53.941702] (stk) :unknown packet
    [ 53.945188] (stk) :unknown packet
    [ 53.948666] (stk) :unknown packet
    [ 53.952392] (stk) :unknown packet
    [ 53.952407] (stk) : request_firmware failed(errno -2) for TIInit_0.0.0.bts
    [ 53.952414] (stk) :download firmware failed

    I do have RTS CTS enabled, and flow control enabled.

    [ 53.926859] >in>04
    [ 53.929021] >in>0e 0c 01 01 10 00 06 00 00 06 0d 00 0f 1f

    is what i think is causing problem. Any suggestions ??

  • Hi,

    In the St_kim.c file, in function read_local_version(), using the below code we parse respond and get the required firmware version
    version =
    MAKEWORD(kim_gdata->resp_buffer[12],
    kim_gdata->resp_buffer[13]);
    chip = (version & 0x7C00) >> 10;
    min_ver = (version & 0x007F);
    maj_ver = (version & 0x0380) >> 7;

    if (version & 0x8000)
    maj_ver |= 0x0008;


    In your case the make wore will take the last two parametes amd makeword and give the version as 0x1F0F
    using which if it is parsed you should be getting the script version as TIInit_7.6.15.bts, it is strange to see you are getting TIInit_0.0.0.bts.
    Please double if the something is wrong in this part of the code.
  • I think since the response is split by a line break, all the data after 0x04 is neing treated as unknown packets. And since there is a line break it evaluates all other expected parts of the response to be all zeros,
  • I tried using hciattach, before uim-sys. It was able to download the firmware correctly but i recieved hci command timeouts and bluedroid restarted. So i dont know if its the setup or the code which is causing problem.
  • Hi,

    Do you any logs that you can provided?
  • do you need uim-sys logs ?
  • here is the log:

    01-01 17:00:26.930 D/BluetoothManagerService( 2611): Auto-enabling Bluetooth.
    01-01 17:00:26.930 D/BluetoothManagerService( 2611): Message: 1
    01-01 17:00:26.930 D/BluetoothManagerService( 2611): MESSAGE_ENABLE: mBluetooth = null
    01-01 17:00:26.950 I/ActivityManager( 2611): Start proc com.android.bluetooth for service com.android.bluetooth/.btservice.AdapterService: pid=3191 uid=1002 gids={41002, 3003, 3002, 3001, 1028, 1015, 3005, 1016, 3008}
    01-01 17:00:26.970 D/BluetoothManagerService( 2611): Message: 30
    01-01 17:00:26.970 D/BluetoothManagerService( 2611): Message: 30
    01-01 17:00:27.190 D/BluetoothAdapterService( 3191): REFCOUNT: CREATED. INSTANCE_COUNT1
    01-01 17:00:27.200 D/BluetoothManagerService( 2611): Message: 20
    01-01 17:00:27.200 D/BluetoothManagerService( 2611): Added callback: android.bluetooth.IBluetoothManagerCallback$Stub$Proxy@42089400:true
    01-01 17:00:27.200 D/BluetoothAdapterState( 3191): make
    01-01 17:00:27.200 I/bluedroid( 3191): init
    01-01 17:00:27.200 I/BluetoothAdapterState( 3191): Entering OffState
    01-01 17:00:27.200 I/bte_conf( 3191): Attempt to load stack conf from /etc/bluetooth/bt_stack.conf
    01-01 17:00:27.210 I/bluedroid( 3191): get_profile_interface socket
    01-01 17:00:27.210 I/GKI_LINUX( 3191): gki_task_entry: gki_task_entry task_id=1 [BTIF] starting
    01-01 17:00:27.210 I/BluetoothAdapterProperties( 3191): adapterPropertyChangedCallback with type:2 len:6
    01-01 17:00:27.210 D/BluetoothAdapterProperties( 3191): Address is:84:DD:20:37:30:89
    01-01 17:00:27.210 I/BluetoothAdapterProperties( 3191): adapterPropertyChangedCallback with type:1 len:10
    01-01 17:00:27.210 D/BluetoothManagerService( 2611): BluetoothServiceConnection: com.android.bluetooth.btservice.AdapterService
    01-01 17:00:27.210 D/BluetoothManagerService( 2611): Message: 40
    01-01 17:00:27.210 D/BluetoothManagerService( 2611): MESSAGE_BLUETOOTH_SERVICE_CONNECTED: 1
    01-01 17:00:27.230 I/bluedroid( 3191): config_hci_snoop_log
    01-01 17:00:27.230 D/BluetoothManagerService( 2611): Calling onBluetoothServiceUp callbacks
    01-01 17:00:27.230 D/BluetoothManagerService( 2611): Broadcasting onBluetoothServiceUp() to 5 receivers.
    01-01 17:00:27.230 D/BluetoothAdapterState( 3191): CURRENT_STATE=OFF, MESSAGE = USER_TURN_ON
    01-01 17:00:27.780 D/BluetoothAdapterProperties( 3191): Name is: Pivot 87xx
    01-01 17:00:27.780 D/BluetoothManagerService( 2611): Bluetooth Adapter name changed to Pivot 87xx
    01-01 17:00:27.780 D/BluetoothManagerService( 2611): Stored Bluetooth name: Pivot 87xx
    01-01 17:00:28.260 D/BluetoothAdapterProperties( 3191): Setting state to 11
    01-01 17:00:28.260 I/BluetoothAdapterState( 3191): Bluetooth adapter state changed: 10-> 11
    01-01 17:00:28.260 D/BluetoothAdapterService( 3191): Broadcasting updateAdapterState() to 1 receivers.
    01-01 17:00:28.260 D/BluetoothManagerService( 2611): Message: 60
    01-01 17:00:28.260 D/BluetoothManagerService( 2611): MESSAGE_BLUETOOTH_STATE_CHANGE: prevState = 10, newState=11
    01-01 17:00:28.260 D/BluetoothManagerService( 2611): Bluetooth State Change Intent: 10 -> 11
    01-01 17:00:28.260 D/BluetoothBondStateMachine( 3191): make
    01-01 17:00:28.270 I/BluetoothBondStateMachine( 3191): StableState(): Entering Off State
    01-01 17:00:28.270 I/BluetoothHidServiceJni( 3191): classInitNative: succeeds
    01-01 17:00:28.280 D/HidService( 3191): Received start request. Starting profile...
    01-01 17:00:28.280 I/bluedroid( 3191): get_profile_interface hidhost
    01-01 17:00:28.280 D/BluetoothAdapterService( 3191): Profile still not running:com.android.bluetooth.gatt.GattService
    01-01 17:00:28.280 I/BluetoothAdapterState( 3191): Entering PendingCommandState State: isTurningOn()=true, isTurningOff()=false
    01-01 17:00:28.280 I/BtGatt.JNI( 3191): classInitNative(L685): classInitNative: Success!
    01-01 17:00:28.280 D/BtGatt.DebugUtils( 3191): handleDebugAction() action=null
    01-01 17:00:28.290 D/BtGatt.GattService( 3191): Received start request. Starting profile...
    01-01 17:00:28.290 D/BtGatt.GattService( 3191): start()
    01-01 17:00:28.290 I/bluedroid( 3191): get_profile_interface gatt
    01-01 17:00:28.290 D/BluetoothAdapterState( 3191): CURRENT_STATE=PENDING, MESSAGE = STARTED, isTurningOn=true, isTurningOff=false
    01-01 17:00:28.290 I/bluedroid( 3191): enable
    01-01 17:00:28.290 I/bt_hci_bdroid( 3191): init
    01-01 17:00:28.290 I/libbt_ti( 3191): vendor Init
    01-01 17:00:28.290 I/bt_hci_bdroid( 3191): bt_hc_worker_thread started
    01-01 17:00:28.290 I/GKI_LINUX( 3191): gki_task_entry: gki_task_entry task_id=0 [BTU] starting
    01-01 17:00:28.290 I/bt-btu ( 3191): btu_task pending for preload complete event
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim:open again INSTALL_SYSFS_ENTRY
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim:reread INSTALL_SYSFS_ENTRY
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim:read 49
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim:st_uart_config
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim: Inside st_uart_config
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim:install set to 1
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim:opening /dev/ttymxc4, while already open
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim:cleanup
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim: Inside set_baud_rate
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim: set_baud_rate() done
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim: Installed N_TI_WL Line displine
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim:read INSTALL_SYSFS_ENTRY
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim:read 10
    01-01 17:00:28.430 E/uim-sysfs( 2253): uim:poll loop
    01-01 17:00:28.500 E/uim-sysfs( 2253): uim:open again INSTALL_SYSFS_ENTRY
    01-01 17:00:28.500 E/uim-sysfs( 2253): uim:reread INSTALL_SYSFS_ENTRY
    01-01 17:00:28.500 E/uim-sysfs( 2253): uim:read 48
    01-01 17:00:28.500 E/uim-sysfs( 2253): uim:st_uart_config
    01-01 17:00:28.500 E/uim-sysfs( 2253): uim: Inside st_uart_config
    01-01 17:00:28.500 E/uim-sysfs( 2253): uim: Un-Installed N_TI_WL Line displine
    01-01 17:00:28.500 E/uim-sysfs( 2253): uim:cleanup
    01-01 17:00:28.540 E/uim-sysfs( 2253): uim:read INSTALL_SYSFS_ENTRY
    01-01 17:00:28.540 E/uim-sysfs( 2253): uim:read 10
    01-01 17:00:28.540 E/uim-sysfs( 2253): uim:poll loop
    01-01 17:00:28.640 D/dalvikvm( 3300): GC_CONCURRENT freed 278K, 11% free 2883K/3220K, paused 11ms+2ms, total 53ms
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim:open again INSTALL_SYSFS_ENTRY
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim:reread INSTALL_SYSFS_ENTRY
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim:read 49
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim:st_uart_config
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim: Inside st_uart_config
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim:install set to 1
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim: Inside set_baud_rate
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim: set_baud_rate() done
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim: Installed N_TI_WL Line displine
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim:read INSTALL_SYSFS_ENTRY
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim:read 10
    01-01 17:00:28.660 E/uim-sysfs( 2253): uim:poll loop
    01-01 17:00:28.700 D/dalvikvm( 2775): GC_CONCURRENT freed 389K, 18% free 2951K/3564K, paused 47ms+29ms, total 117ms
    01-01 17:00:28.720 E/uim-sysfs( 2253): uim:open again INSTALL_SYSFS_ENTRY
    01-01 17:00:28.720 E/uim-sysfs( 2253): uim:reread INSTALL_SYSFS_ENTRY
    01-01 17:00:28.720 E/uim-sysfs( 2253): uim:read 48
    01-01 17:00:28.720 E/uim-sysfs( 2253): uim:st_uart_config
    01-01 17:00:28.720 E/uim-sysfs( 2253): uim: Inside st_uart_config
    01-01 17:00:28.720 E/uim-sysfs( 2253): uim: Un-Installed N_TI_WL Line displine
    01-01 17:00:28.720 E/uim-sysfs( 2253): uim:cleanup
    01-01 17:00:28.760 E/uim-sysfs( 2253): uim:read INSTALL_SYSFS_ENTRY
    01-01 17:00:28.760 E/uim-sysfs( 2253): uim:read 10
    01-01 17:00:28.760 E/uim-sysfs( 2253): uim:poll loop
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim:open again INSTALL_SYSFS_ENTRY
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim:reread INSTALL_SYSFS_ENTRY
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim:read 49
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim:st_uart_config
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim: Inside st_uart_config
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim:install set to 1
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim: Inside set_baud_rate
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim: set_baud_rate() done
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim: Installed N_TI_WL Line displine
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim:read INSTALL_SYSFS_ENTRY
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim:read 10
    01-01 17:00:28.870 E/uim-sysfs( 2253): uim:poll loop
    01-01 17:00:28.930 E/uim-sysfs( 2253): uim:open again INSTALL_SYSFS_ENTRY
    01-01 17:00:28.930 E/uim-sysfs( 2253): uim:reread INSTALL_SYSFS_ENTRY
    01-01 17:00:28.930 E/uim-sysfs( 2253): uim:read 48
    01-01 17:00:28.930 E/uim-sysfs( 2253): uim:st_uart_config
    01-01 17:00:28.930 E/uim-sysfs( 2253): uim: Inside st_uart_config
    01-01 17:00:28.930 E/uim-sysfs( 2253): uim: Un-Installed N_TI_WL Line displine
    01-01 17:00:28.930 E/uim-sysfs( 2253): uim:cleanup
    01-01 17:00:28.980 E/uim-sysfs( 2253): uim:read INSTALL_SYSFS_ENTRY
    01-01 17:00:28.980 E/uim-sysfs( 2253): uim:read 10
    01-01 17:00:28.980 E/uim-sysfs( 2253): uim:poll loop
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim:open again INSTALL_SYSFS_ENTRY
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim:reread INSTALL_SYSFS_ENTRY
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim:read 49
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim:st_uart_config
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim: Inside st_uart_config
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim:install set to 1
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim: Inside set_baud_rate
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim: set_baud_rate() done
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim: Installed N_TI_WL Line displine
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim:read INSTALL_SYSFS_ENTRY
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim:read 10
    01-01 17:00:29.090 E/uim-sysfs( 2253): uim:poll loop
    01-01 17:00:29.160 E/uim-sysfs( 2253): uim:open again INSTALL_SYSFS_ENTRY
    01-01 17:00:29.160 E/uim-sysfs( 2253): uim:reread INSTALL_SYSFS_ENTRY
    01-01 17:00:29.160 E/uim-sysfs( 2253): uim:read 48
    01-01 17:00:29.160 E/uim-sysfs( 2253): uim:st_uart_config
    01-01 17:00:29.160 E/uim-sysfs( 2253): uim: Inside st_uart_config
    01-01 17:00:29.160 E/uim-sysfs( 2253): uim: Un-Installed N_TI_WL Line displine
    01-01 17:00:29.160 E/uim-sysfs( 2253): uim:cleanup
    01-01 17:00:29.220 E/uim-sysfs( 2253): uim:read INSTALL_SYSFS_ENTRY
    01-01 17:00:29.220 E/uim-sysfs( 2253): uim:read 10
    01-01 17:00:29.220 E/uim-sysfs( 2253): uim:poll loop
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim:open again INSTALL_SYSFS_ENTRY
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim:reread INSTALL_SYSFS_ENTRY
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim:read 49
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim:st_uart_config
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim: Inside st_uart_config
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim:install set to 1
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim: Inside set_baud_rate
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim: set_baud_rate() done
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim: Installed N_TI_WL Line displine
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim:read INSTALL_SYSFS_ENTRY
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim:read 10
    01-01 17:00:29.330 E/uim-sysfs( 2253): uim:poll loop
    01-01 17:00:29.400 E/uim-sysfs( 2253): uim:open again INSTALL_SYSFS_ENTRY
    01-01 17:00:29.400 E/uim-sysfs( 2253): uim:reread INSTALL_SYSFS_ENTRY
    01-01 17:00:29.400 E/uim-sysfs( 2253): uim:read 48
    01-01 17:00:29.400 E/uim-sysfs( 2253): uim:st_uart_config
    01-01 17:00:29.400 E/uim-sysfs( 2253): uim: Inside st_uart_config
    01-01 17:00:29.400 E/uim-sysfs( 2253): uim: Un-Installed N_TI_WL Line displine
    01-01 17:00:29.400 E/uim-sysfs( 2253): uim:cleanup

    [ 53.778053] (hci_tty): inside hci_tty_open (d72a6130, d2c90140)
    [ 53.784192] (stc): st_register(4)
    [ 53.787668] (stc): chnl_id list empty :4
    [ 53.791790] (stk) : st_kim_start
    [ 53.909975] (stk) :ldisc_install = 1
    [ 53.915072] (stc): st_tty_open
    [ 53.918518] (stk) :line discipline installed
    [ 53.922760] <out<01 01 10 00
    [ 53.926859] >in>04
    [ 53.929021] >in>0e 0c 01 01 10 00 06 00 00 06 0d 00 0f 1f
    [ 53.929227] (stk) :TIInit_0.0.0.bts
    [ 53.938133] (stk) :unknown packet
    [ 53.941702] (stk) :unknown packet
    [ 53.945188] (stk) :unknown packet
    [ 53.948666] (stk) :unknown packet
    [ 53.952392] (stk) :unknown packet
    [ 53.952407] (stk) : request_firmware failed(errno -2) for TIInit_0.0.0.bts
    [ 53.952414] (stk) :download firmware failed

  • Hi,

    I don't see any reason for a crash.
    Hope you have followed all the steps from here http://e2e.ti.com/support/wireless_connectivity/f/538/t/294284, on bringing up Bluedroid on android.
  • Yes, i have followed all the steps and i do see correct version from the chip but somehow the data from uart is being recieved in parts and thus, its resulting in read version failure.

  • Hi sandeep, if cts and rts are interchanged, could it lead to such a situation or in that case chip wont work at all.

    Is it possible to check by removing flow control completely..??
  • Neeraj,

    How have you connected RTS and CTS?

    On the i.mx6 you need to connect the uart_rts to wl8 rts and uart_cts to wl8_cts. This is a different naming convention to a TI processor which would assume you crossover the rts and cts lines between devices.

    If you have crossed them over then there may be a pin mux option for these pins to swap them that you can manage via the DTS file. However, I've not investigated that.

    Iain