Bluetooth hciattach on FX30S

Hi @mahtab,
Are you sure it’s working though? If you use “any”, I don’t believe the actual hci0 interface is working.

From your stty output, the port is set to 9600 baud while hciattach is at 115200.

Also, I don’t think there is a comma missing, this should concatenate the FIRMWARE_DIRECTORY string with the TIINIT string.

Hi @GabiSRC,
That’s great, try running the hciconfig tool now

Hi @cchenry,
When I run the command, I get:
root@fx30:/legato/apps/e0d0a1631b75f51c01a659e398b5c876/read-only/bin# ./hciconfig -a
hci0: Type: BR/EDR Bus: UART
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:0 acl:0 sco:0 events:0 errors:0
TX bytes:36 acl:0 sco:0 commands:9 errors:0
Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Packet type: DM1 DH1 HV1
Link policy:
Link mode: SLAVE ACCEPT

and

root@fx30:/legato/apps/e0d0a1631b75f51c01a659e398b5c876/read-only/bin# ./hciconfig hci0 up
Can't init device hci0: Connection timed out (110)

I’ll try the same with my new bluetooth device and I’ll also try with my smartphone :slight_smile:

Also, when I rebooted my FX and try again the script, I have:
root@fx30:/legato/apps/e0d0a1631b75f51c01a659e398b5c876/read-only/bin# ./bt-init.sh
PWD is: /legato/apps/e0d0a1631b75f51c01a659e398b5c876/read-only/bin
Can't set device: Device or resource busy
Can't initialize device: Device or resource busy
hci0: Type: BR/EDR Bus: UART
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
DOWN
RX bytes:0 acl:0 sco:0 events:0 errors:0
TX bytes:24 acl:0 sco:0 commands:6 errors:0
Can't init device hci0: Connection timed out (110)

So, there are new errors now…

Hi @mahtab,
To cross compile the hci tools, you need to set the PATH environment variable.

Run the command to find your location of the cross compiler:

find /opt/swi -name '*-gcc'

Then add it to your path, something like this (the path without the compiler):

export PATH=$PATH:/opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi

Hi @mahtab, @GabiSRC,
How did each of you build the FX30 kernel with the bluetooth options? Did you follow the legato-spm or did you grab the WP85 source package?

Hi @cchenry,
I did the following:

  1. legato-spm -s http://updatesite.sierrawireless.com/packages/Legato/earlyAccess/fx30/16.10.1/ -i -m “FX30(WP85XX)” -k pdk.64
  2. I copied the tar inside the legato.sdk**fx30_wp85**/resources/source directory and I untared it
  3. I followed the asci build prep and I ran the make command to build the default kernel
  4. then I followed Bluetooth WL18xx driver for mangOH · mangOH/mangOH Wiki · GitHub from step 5

Guys,

I got it working fine now:

hci0:   Type: BR/EDR  Bus: UART
    BD Address: D0:B5:C2:F1:93:92  ACL MTU: 1021:6  SCO MTU: 180:4
    UP RUNNING 
    RX bytes:587 acl:0 sco:0 events:28 errors:0
    TX bytes:393 acl:0 sco:0 commands:28 errors:0

root@fx30:/legato/apps/32659631a8e706044673ab6fa0ce52b4/read-only/bin# ./hcitool lescan
LE Scan ...
22:F8:FC:A2:49:64 (unknown)
3B:AB:4D:3D:D6:0D (unknown)
70:B3:D5:19:9D:AD 70:B3:D5:19:9D:AD  1
70:B3:D5:00:14:2A 70B3D500142A04730

The TI file is out of date for the IoT card, what fixed it was getting an updated firmware driver and replacing the one in the demo app. That’s all that was needed. It’s very important to get the right firmware driver for your bluetooth device.

One thing I’d still like some help with is, I want to develop a legato app that can call on the hci & rfcomm api, instead of running the hci tools on the command line, but the build_bluex_util scripts don’t produce any libraries that I can see - there are .lo and .la files for bluetooth but not a .so dynamic library. How would I go about producing a dynamic library that I can use in my legato application ?

update - actually I can see a libbluetooth-internal.a and a libbluetooth.so.x.x.x file after enabling build library support, but if I include them in a ldflags section of a cdef I still get build errors resolving hci_ api calls )…ahh it’s ok, figured it out…

That’s great to hear @mahtab.

For my side, I didn’t need to change the TI firmware version. Rather, the UART2 CTS line needs to be driven low in order to communicate with the TI chip.

@GabiSRC, where are you at now? I’m unsure if you’re using the TI chip or a different one still?

Hi,
Still the same for me…(with a non-TI chip)
So if I understand correctly, for each bluetooth device manufacturer, we need to put the correct firmware?

@GabiSRC

If “any” doesn’t get you a BD Address, then you’d have to get the right firmware file for your chip. It shouldn’t be too hard to track down from the vendor or even from reading off the top of the chip - or the IOT card. Then you have to make sure that hciconfig recognizes the type, like “texas”. Check the file hciattach.c around line 1100

Hi @GabiSRC,
Each BT mfg is different. If you look at hciattach.c around the area the mahtab mentioned, you’ll see there’s a table of different manufacturers. Check to see if yours is there and already supported.

For the TI chip, the bts file is loaded when hciattach is called. Are you currently using “any” when you call hciattach?

Could you please verify if the chipset you’re using supports 2-wire UART only mode?

@mahtab Where did you get the correct firmware ? Where did you place the firmware so that it will be uploaded to the chip ?

I am also facing the same issue.

What should we do next, I’m able to scan the the surrounding BT and paired, but couldn’t connect the any devices.

Hi @codegit001,
Did you resolve your issue? The firmware needs to be placed here:
/legato/systems/current/apps/bluetoothUtil/read-only/bin
BR,
Chris

Hi Jordan,
You can use a tool like gatttool to connect to the device and query information from it.
BR,
Chris