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.

WL1837MOD: wl1837 BT module kernel configuration and debugging issues

Part Number: WL1837MOD
Other Parts Discussed in Thread: WL1837, AM5728, TMDSEVM572X

Hi ,

I am in the process of debugging Bluetooth encountered difficulties, the following are some of my configuration:

Chip : am5728

BT : wl1837

Kernel : 4.4.12

SDK : ti-processor-sdk-linux-am57xx-evm-03.00.00.04

Board: custom board

Firmware :  TIInit_11.8.32.bts

Dvice tree :

     tibt {
          compatible = "tibt";
          nshutdown_gpio = <132>;
          dev_name = "/dev/ttyS7";
          flow_cntrl = <1>;
         baud_rate = <3000000>;
     };
  &uart10 {
      status = "okay";
  };

Kernel configuration :

CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y
CONFIG_BT_HCIUART_LL=y
CONFIG_BT_HCIUART_3WIRE=y

I have CONFIG_TI_ST enabled and CONFIG_BT_WILINK built as module. But CONFIG_ST_HCI is not available in kernel 4.4.12. Could this be related?

I succeeded in building Bluetopia PM and porting it to my board, but there was an error running the script on the board:

root@am57xx-evm:~/BluetopiaPM/bin# ./SS1BTPM & ./LinuxSPPM

[1] 1087

SPPM>1 1

BTPM_Initialize() Success: 0.
DEVM_RegisterEventCallback() Success: 5.
SPPM>9 1

echo 132 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio132/direction
echo 0 > /sys/class/gpio/gpio132/value
echo 1 > /sys/class/gpio/gpio132/value
echo 0 > /sys/class/gpio/gpio132/value
echo 1 > /sys/class/gpio/gpio132/value
BT COMM PORT (/dev/ttyS7): -5
DEVM_PowerOnDevice() Failure: -14, Unknown Error.
Function Error.

Here's "dmesg | grep luetooth":

[    7.469188] Bluetooth: Core ver 2.21
[    7.501466] Bluetooth: HCI device and connection manager initialized
[    7.501478] Bluetooth: HCI socket layer initialized
[    7.501486] Bluetooth: L2CAP socket layer initialized
[    7.501523] Bluetooth: SCO socket layer initialized
[   37.854195] Bluetooth: HCI UART driver ver 2.3
[   37.858857] Bluetooth: HCI UART protocol H4 registered
[   37.864020] Bluetooth: HCI UART protocol BCSP registered
[   37.871853] Bluetooth: HCI UART protocol LL registered
[   37.877016] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   37.924047] Bluetooth: st_register failed -22

Here's "hciattach /dev/ttyS7 texas 300000":

root@am57xx-evm:~/BluetopiaPM/bin# hciattach /dev/ttyS7 texas 300000                     
Can't get port settings: Input/output error
Can't initialize device: Input/output error

Device tree is how the value of the "nshutdown_gpio", I use the GPIO7_15 is the corresponding 132?

Or is my kernel configuration incomplete, but also add other options?

I would like to know how AM5728EVM debugging.

Used to compare my configuration and debugging.

Thanks.

Better

  • Hi,

    You are actually mixing here between two separate Bluetooth stacks.

    All CONFIG_BT_XXX related switches are used for enabling bluez which is not officially supported by TI.

    Bluetopia PM is a different bluetooth stack (TI Bluetooth stack) and is totally independent of bluez.
    So basically when testing BLuetopia hciattach should not be used.
    Same for CONFIG_TI_ST and CONFIG_BT. They can be disabled.

    If I am not mistaken GPIO7_15 actually maps to 232 (7*32+15) so this may be a mistake in your .dts settings.

    BR,
    Eyal
  • Hi Eyal,

    Thanks for the tip, disable CONFIG_TI_ST and CONFIG_BT did not change anything.
    And CONFIG_BT_WILINK has been disabled, I do not need any drive?(CONFIG_BT_WILINK dependent CONFIG_TI_ST)
    Is GPIO7_15 actually mapped to 232 instead of 239? I changed after 239 is still wrong.
    SPPM>1 1

    BTPM_Initialize() Success: 0.
    DEVM_RegisterEventCallback() Success: 5.
    SPPM>9 1

    echo 239 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio239/direction
    echo 0 > /sys/class/gpio/gpio239/value
    echo 1 > /sys/class/gpio/gpio239/value
    echo 0 > /sys/class/gpio/gpio239/value
    echo 1 > /sys/class/gpio/gpio239/value
    BT COMM PORT (/dev/ttyS7): -5
    DEVM_PowerOnDevice() Failure: -14, Unknown Error.
    Function Error.

    dmesg | grep luetooth
    [ 7.426761] Bluetooth: Core ver 2.21
    [ 7.426802] Bluetooth: HCI device and connection manager initialized
    [ 7.426812] Bluetooth: HCI socket layer initialized
    [ 7.426819] Bluetooth: L2CAP socket layer initialized
    [ 7.426845] Bluetooth: SCO socket layer initialized

    How should I debug it? What needs to be changed?

    Thanks.

    Better
  • Hi Eyal,

    What is the difference between using BLuetopia and hciattach tests?

    I am using the AM335xBluetopiaLinuxProduction-4.0.3.0.1.0,

    This package is generic?  or AM5728  have a special package.

    Thanks.

    Better

  • Hi Better,

    Better Louis said:

    What is the difference between using BLuetopia and hciattach tests?

    I am using the AM335xBluetopiaLinuxProduction-4.0.3.0.1.0,

    This package is generic?  or AM5728  have a special package.

    The AM335xBluetopiaLinuxProduction-4.0.3.0.1.0 is generic and can be used with the AM5728.

    Better Louis said:

    SPPM>9 1

    echo 132 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio132/direction
    echo 0 > /sys/class/gpio/gpio132/value
    echo 1 > /sys/class/gpio/gpio132/value
    echo 0 > /sys/class/gpio/gpio132/value
    echo 1 > /sys/class/gpio/gpio132/value
    BT COMM PORT (/dev/ttyS7): -5
    DEVM_PowerOnDevice() Failure: -14, Unknown Error.
    Function Error.

    The "BT COMM PORT (/dev/ttyS7): -5" indicates that the ti dual-mode Bluetooth stack was not able to gain access to thee serial port (/dev/ttyS7 in this case). This could happen if a kernel module and or another application has lock on the serial port.

    The ti dual-mode Bluetooth stack for linux and the sample applications (in the AM335xBluetopiaLinuxProduction-4.0.3.0.1.0) run in user space and do not require any kernel modules. So it is recommended not to have btwilink in the device tree or anything else that accesses the ttyS7 at bootup. The 'tibt' section of the device tree looks fine and I was able to verify it on the TMDSEVM572X. Please re-examine the rest of the device tree for anything that can be accessing the '/dev/ttyS7'.

    Best regards,

    Vihang

  • Hi Vihang,

    Your advice is helpful.

    When I use the correct serial port, the situation has improved, but one of the function error.

    SPPM>1 1                                                                       

    BTPM_Initialize() Success: 0.                                                   

    DEVM_RegisterEventCallback() Success: 5.                                       

    SPPM>9 1                                                                        
                                                                                    
    echo 239 > /sys/class/gpio/export                                               

    echo out > /sys/class/gpio/gpio239/direction                                    

    echo 0 > /sys/class/gpio/gpio239/value                                          

    echo 1 > /sys/class/gpio/gpio239/value                                          

    echo 0 > /sys/class/gpio/gpio239/value                                          

    echo 1 > /sys/class/gpio/gpio239/value                                          

    BT COMM PORT (/dev/ttyS9): 1                                                    

    DEVM_PowerOnDevice() Failure: -4, Unknown Error.                                

    Function Error.

    I'm using GPIO7_15 and UART10 (TTYS9), what does this error mean and what do I need to modify?

    Thanks.

    Better

  • Hi Vihang,

    Thank you for your help, I solved the problem, there is a hardware error.

    Thanks.

    Better