TB-96AIoT bluetooth getting it up

Has anybody got the bluetooth up and running on TB-96AIoT? Any guides?

After reading the documentation coming with the buildroot working directories, I found a bluetooth deviceio_release repo and modified to get it build and run. When selecting its commands 01-open, 94-close, 51-start-ble: repeat 01,94,01,94, … 01 a few times until no more errors, then 51. An android NrfConnect app can see the 96AIoT named ROCKCHIP_AUDIO and can connect to it. But the problem with this repo is that it is only a release repo, no much information as to how you can bring bluetooth up in a normal system without running this binary.

Does anybody know where to find the source repo for “deviceio”?

I have also noticed a discussion for bluetooth on a rock960 thread for bluetooth in debian. Has anybody been successful with its steps on TB-96AIoT?

Did you try to reset the chip via rfkill, from script you pointed, it should be something like:

echo 0 > /sys/class/rfkill/rfkill0/state
sleep 1
echo 1 > /sys/class/rfkill/rfkill0/state

and try to use hciattach, from what I understand bt is behind ttyS4 (/dev/ttyS4)

Hi, Loic,

I could not figure out how to get hciattach to work:

[root@rk1808:/]# echo 0 > /sys/class/rfkill/rfkill0/state
[root@rk1808:/]# echo 1 > /sys/class/rfkill/rfkill0/state
[root@rk1808:/]# hciattach /dev/ttyS4 bcm43xx
bcm43xx_init
Cannot open directory '/etc/firmware': No such file or directory
Patch not found, continue anyway
Set Controller UART speed to 3000000 bit/s
Device setup complete

I guess it will need more debugging and fixing. But eventually I’m using a logic like the following:

function bt_reset() {
  echo 0 > /sys/class/rfkill/rfkill0/state
  sleep 1
  echo 1 > /sys/class/rfkill/rfkill0/state
  sleep 1
}

function brcm_start() {
  brcm_patchram_plus1 --bd_addr_rand --enable_hci \
    --no2bytes --use_baudrate_for_download --tosleep 200000 \
    --baudrate 1500000 --patchram /system/etc/firmware/BCM4356A2.hcd \
    /dev/ttyS4 > /dev/null 2>&1 &
  sleep 5 # at least 3 till it finishes
}

function btd_start() {
  /usr/libexec/bluetooth/bluetoothd -C -n -E > /dev/null 2>&1 &
  sleep 1
}

bt_reset
brcm_start
btd_start

Thanks for the help!

While looking at the stock evb image, it contains a rk_wifi_init binary that is called by the init script.

It looks 96boards build has been missing this binary:

~/rk96boards-buildroot/linux$ grep -r rk_wifi_init *
Binary file buildroot/output/rockchip_rk1808/images/rootfs.cpio matches
Binary file buildroot/output/rockchip_rk1808/images/rootfs.tar matches
Binary file buildroot/output/rockchip_rk1808/images/rootfs.ext2 matches
Binary file buildroot/output/rockchip_rk1808/build/rkwifibt-1.0.0/rkwifibt-1.0.0.tar matches
buildroot/output/rockchip_rk1808/build/rkwifibt-1.0.0/S66load_wifi_modules:		rk_wifi_init BT_TTY_DEV
buildroot/output/rockchip_rk1808/target/etc/init.d/S66load_wifi_modules:		rk_wifi_init BT_TTY_DEV
buildroot/package/rockchip/rkwifibt/rkwifibt.mk:    $(TARGET_CC) -o $(@D)/src/rk_wifi_init $(@D)/src/rk_wifi_init.c
buildroot/package/rockchip/rkwifibt/rkwifibt.mk:    $(INSTALL) -D -m 0755 $(@D)/src/rk_wifi_init $(TARGET_DIR)/usr/bin/rk_wifi_init
Binary file external/rkwifibt/.git/index matches
external/rkwifibt/S66load_wifi_modules:		rk_wifi_init BT_TTY_DEV