The TiWi R2 module on the Nitrogen6X board contains both Wi-Fi and Bluetooth and it seems we haven’t
documented the interface to the Bluetooth portion.
This short post aims to remedy that.
There are essentially two connections from the i.MX6 to the TI Bluetooth device:
There are other ways to do this, but the sysfs GPIO interface allows us to control the reset line and we can use bluez to configure the Bluetooth interface as follows:
root@linaro-alip:~# bluetoothd root@linaro-alip:~# echo 176 >/sys/class/gpio/export root@linaro-alip:~# echo low >/sys/class/gpio/gpio176/direction root@linaro-alip:~# # sleep 1 is needed here if you write a script root@linaro-alip:~# echo high >/sys/class/gpio/gpio176/direction root@linaro-alip:~# hciattach -t 30 -s 115200 /dev/ttymxc2 texas 3000000 flow Found a Texas Instruments' chip! Firmware file : /lib/firmware/TIInit_7.2.31.bts Loaded BTS script version 1 texas: changing baud rate to 3000000, flow control to 1 Device setup complete root@linaro-alip:~# hcitool scan Scanning ... 00:21:4F:B8:A3:C9 ericsony-0 9C:B7:0D:AB:48:60 MIKEE6430
Let’s walk through this in steps:
- bluetoothd – This starts up the Bluetooth daemon to manage all Bluetooth connections,
- echo to /sys/class/gpio/blah – These lines tell the system to expose GP6:16 (#176), then drive the reset pin as an output low (asserted), followed by high (deasserted),
- hciattach – This line connects the HCI (Bluetooth) device to the serial port at 3Mbps and configures it as a Texas Instruments device with flow control. Note that this also downloads the firmware from /lib/firmware/TIInit_7.2.31.bts,
- hcitool scan – This line scans for local devices. Now I need to walk around the office to find out who Mike is…