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.

WL1835 bluetooth agent can't get default adapter

Other Parts Discussed in Thread: WL1835

Hi,

I am trying to use WL1835  bluetooth with AM335x EVM. Software is meta-arago daisy.

When I run bluetooth agent, I get error  "Can't get default adapter"

Following is the sequence of commands:

root@am335x-evm:~# bluetoothd

root@am335x-evm:~# hciconfig hci0 up

[  944.008593] (stc):  chnl_id list empty :4
[  944.012749] (stk) : st_kim_start(stk) :ldisc_install = 1uim:poll broke due to event 10(PRI:2/ERR:8)

uim:read 1 from install

uim:@ st_uart_config
uim: signal received, opening /dev/ttyS1
uim:@ set_baud_rate
uim:set_baud_rate() done
uim:Setting speed to 3000000
uim:@ read_command_complete
uim: Command complete started
uim:@ read_hci_event
uim: read_hci_event
uim:Command complete done
[  944.180311] (stc): st_tty_open
uim:Speed changing to 3000000, 1
uim:@ set_custom_baud_rate
(stk) :line discipline installeduim:Installed N_TI_WL Line displine
[  944.194437] (stk) :TIInit_11.8.32.bts
uim:begin polling...
(stk) :change remote baud rate command in firmware
[  944.214516] (stk) :skipping the wait event of change remote baud[  944.928331] (stc): add_channel_to_table: id 4
[  944.932771] (stc): add_channel_to_table: id 2
[  944.937149] (stc): add_channel_to_table: id 3

root@am335x-evm:~# hcitool scan
Scanning ...
        00:02:72:E3:0F:7F       RS232 Dongle Slave

root@am335x-evm:~# agent hci0 00:02:72:E3:0F:7F
Can't get default adapter
No such adapter

root@am335x-evm:~# dmesg | grep Bluetooth
[    3.475348] Bluetooth: Core ver 2.18
[    3.483613] Bluetooth: HCI device and connection manager initialized
[    3.663793] Bluetooth: HCI socket layer initialized
[    3.668731] Bluetooth: L2CAP socket layer initialized
[    3.814838] Bluetooth: SCO socket layer initialized
[   16.667945] Bluetooth: st_register failed -22

What am I missing here ?

thanks
Ankur

  • Hi Ankur,

    We don't support the BlueZ stack. The supported stack is the TI Bluetooth Stack. Please see: processors.wiki.ti.com/.../WiLink8_Linux_Getting_Started_Guide

    Any reason why you can't use the TI Bluetooth stack?

    Having said that, the error you're getting is probably because dbus is not running or the service file is not present.

    Regards,
    Gigi Joseph.
  • Hi Joseph,

    Thanks for the response.

    I am building the rootfs using Yocto (meta-arago, daisy branch) and BlueZ is coming from there. meta-ti recipe itself includes BlueZ.

    dbus is running but I will check for the service file.

    regards
    Ankur
  • Hi Joseph,

    I checked that dbus is running and service file is also present

    root@am335x-evm:~# cat /usr/share/dbus-1/system-services/org.bluez.service
    [D-BUS Service]
    Name=org.bluez
    Exec=/bin/false
    User=root
    SystemdService=dbus-org.bluez.service
    root@am335x-evm:~# cat /etc/dbus-1/system.d/bluetooth.conf
    <!-- This configuration file specifies the required security policies
         for Bluetooth core daemon to work. -->
    
    <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
     "www.freedesktop.org/.../busconfig.dtd">
    <busconfig>
    
      <!-- ../system.conf have denied everything, so we just punch some holes -->
      <policy user="root">
        <allow own="org.bluez"/>
        <allow send_destination="org.bluez"/>
        <allow send_interface="org.bluez.Agent"/>
        <allow send_interface="org.bluez.PasskeyAgent"/>
      </policy>
    
      <policy context="default">
        <allow own="org.bluez"/>
        <allow send_destination="org.bluez"/>
        <allow send_interface="org.bluez.Agent"/>
      </policy>
    </busconfig> 

    root@am335x-evm:~#

    When I run bluetoothd, I can see org.bluez in dbus list

    root@am335x-evm:~# dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames
    
    method return sender=org.freedesktop.DBus -> dest=:1.4 reply_serial=2
       array [
          string "org.freedesktop.DBus"
          string ":1.4"
          string ":1.0"
          string "org.bluez"
       ]

    But when I query default adapter, I don't get a response

    root@am335x-evm:~# dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.ListAdapters
    
    method return sender=:1.0 -> dest=:1.5 reply_serial=2
       array [
       ]

    I seems there is something small which is missing here. It would be of great help if you can point it out

    thanks

    Ankur

  • Hi Ankur,

    Is bluetoothd even running?
    As I said before, this issue is not related to the TI controller, but to the BlueZ stack. You can get better support from some BlueZ forum (external).

    Regards,
    Gigi Joseph.
  • Hi Joseph,

    Yes, bluetoothd and dbus are indeed running.

    Thanks for your help, I will try some external forums

    Wondering how other users of WL1835 are using it inside Linux. Are they are all using Bluetopia ?

    If yes, then why doesn't TI package bluetopia as part of "meta-ti" Yocto project ? Because as of now, bluetopia is not part of meta-ti and blueZ doesn't work.

    That means WL1835 support is broken !

    regards

    Ankur

  • Ankur,

    BlueZ is open source while BlueTopia it doesn't. we can't upload the stack to the mainline and customers should get it from TI.com under click-wrap.

    Working with BlueZ is fine as long as you don't need support. I believe BlueTopia will get you more and mostly someone to work with.

    Regards,

    Eran

  • Thanks for your response Eran.

    In case someone else like me wants to use BlueZ with WL18xx, disabling CONFIG_TI_ST, CONFIG_ST_HCI in kernel config and removing "kim" node in dts will get BlueZ working.

    I am working on a BlueZ patch that will make WL18xx functional with BlueZ even with Shared Transport enabled (that would be ideal)

    cheers

    Ankur

  • Hi Ankur,

    Did you make any progress on the patch you mentioned above?

    Also for your suggested work-around, any obvious downsides that you know about?

    thanks,
    Will
  • Hi Will,

    Unfortunately I didn't get time to work on the patch.

    For the work-around, I haven't seen any limitation yet. I am able to operate both Wi-Fi and BT at the same time.

    cheers

    Ankur

  • Hi Ankur,

    A work-around might be OK for me in that case, so  I gave this a try earlier - unfortunately without success :0(

    I see that in my kernel at least (3.14.43) the CONFIG_BT_WILINK depends on one of the 2 kernel configs that were removed above (probably CONFIG_TI_ST). This means that the bt_wilink driver is no longer available so UIM will not run & I no longer get hci0.

    I also took out kim from the DTS (completely removed not renamed or other)

    Did I misunderstand something?

    Any hints greatly appreciated.

    many thanks,

    Will

  • Hi Will,

    UIM and KIM are part of TI's shared transport layer which is disabled by removing CONFIG_TI_ST. These are BT specific config options in my kernel

    #BT
    CONFIG_BT=y
    CONFIG_BT_RFCOMM=y
    CONFIG_BT_RFCOMM_TTY=y
    CONFIG_BT_HCIBTUSB=y
    CONFIG_BT_HCIUART=y
    CONFIG_BT_HCIUART_H4=y
    CONFIG_BT_HCIUART_BCSP=y
    CONFIG_BT_HCIUART_LL=y
    CONFIG_BT_HCIBCM203X=y
    CONFIG_BT_HCIBPA10X=y
    CONFIG_BT_WILINK=m
    CONFIG_TI_ST=n
    CONFIG_ST_HCI=n

    Now you have to use hciattach to create hci0. If you get timeout error, then do BT reset and retry. On AM335x-EVM kit, gpio 117 is connected to BT_EN. So these are the commands that I issue to run BT device.

    bluetoothd
    echo 117 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio117/direction
    echo 0 > /sys/class/gpio/gpio117/value
    echo 1 > /sys/class/gpio/gpio117/value
    hciattach -s 115200 /dev/ttyS1 texas 3000000
    hciconfig hci0 up piscan
    hciconfig hci0 name my-bt
    sdptool add SP
    agent 0000 &
    
    #As master
    rfcomm watch rfcomm0 1 &
    
    #Once connection established with slave
    microcom /dev/rfcomm0

    Hope that helps.

    cheers

  • Hi Ankur,

    Just thought I'd follow up with a thank you. This worked fine for me meets my requirement.

    regards,

    Will