bluetooth not working on custom board powered by TX2

I’ve recompiled an nvidia kernel of release 28.2.1 and included all needed bluetooth modules:

CONFIG_BT=y
CONFIG_BT_BREDR=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
CONFIG_BT_HS=y
CONFIG_BT_LE=y

CONFIG_BT_SELFTEST is not set

CONFIG_BT_DEBUGFS=y
CONFIG_BT_INTEL=y
CONFIG_BT_BCM=y
CONFIG_BT_RTL=y
CONFIG_BT_QCA=y
CONFIG_BT_HCIBTUSB=y
CONFIG_BT_HCIBTUSB_BCM=y
CONFIG_BT_HCIBTUSB_RTL=y
CONFIG_BT_HCIBTSDIO=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y
CONFIG_BT_HCIUART_ATH3K=y
CONFIG_BT_HCIUART_LL=y
CONFIG_BT_HCIUART_3WIRE=y
CONFIG_BT_HCIUART_INTEL=y
CONFIG_BT_HCIUART_BCM=y
CONFIG_BT_HCIUART_QCA=y
CONFIG_BT_HCIBCM203X=y
CONFIG_BT_HCIBPA10X=y
CONFIG_BT_HCIBFUSB=y
CONFIG_BT_HCIVHCI=y
CONFIG_BT_MRVL=y
CONFIG_BT_MRVL_SDIO=y
CONFIG_BT_ATH3K=y

By default I see that hci0 is configured on a SDIO bus instead of a UART bus like on the devkit:

nvidia@cam5-71995:~$ hciconfig -a
hci0: Type: BR/EDR Bus: SDIO
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:0 acl:0 sco:0 commands:0 errors:0
Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Packet type: DM1 DH1 HV1
Link policy:
Link mode: SLAVE ACCEPT

On the devkit:

nvidia@tegra-ubuntu:/boot$ hciconfig -a
hci0: Type: BR/EDR Bus: UART
BD Address: 00:04:4B:C4:C7:9A ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:6674693 acl:3748 sco:0 events:76856 errors:0
TX bytes:22060 acl:317 sco:0 commands:1347 errors:0
Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH SNIFF
Link mode: SLAVE ACCEPT
Name: ‘tegra-ubuntu’
Class: 0x000000
Service Classes: Unspecified
Device Class: Miscellaneous,
HCI Version: 4.1 (0x7) Revision: 0x1000
LMP Version: 4.1 (0x7) Subversion: 0x610c
Manufacturer: Broadcom Corporation (15)

I tried to attach a device with hciattach but I get a connection timeout:

nvidia@cam5-71995:~$ sudo hciattach /dev/ttyTHS1 any
Device setup complete

nvidia@cam5-71995:~$ hciconfig -a
hci1: Type: BR/EDR Bus: UART
BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
DOWN INIT RUNNING
RX bytes:0 acl:0 sco:0 events:0 errors:0
TX bytes:12 acl:0 sco:0 commands:3 errors:0
Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Packet type: DM1 DH1 HV1
Link policy:
Link mode: SLAVE ACCEPT

hci0: Type: BR/EDR Bus: SDIO
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:0 acl:0 sco:0 commands:0 errors:0
Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Packet type: DM1 DH1 HV1
Link policy:
Link mode: SLAVE ACCEPT

nvidia@cam5-71995:~$ sudo hciconfig hci1 up
Can’t init device hci1: Connection timed out (110)

Also I found that the service nvwifibt is not running maybe because /proc/bluetooth/sleep/lpm is not existing.

Please help

Hi,

I think you changed the kernel version, When there is a mismatch between Kernel version and Module/Firmware version.The kernel will failed to loaded during the kernel bootup.

With bellow command to confirm the version before or after you update the Image.

uname -a

Hi alanz,

I did change the kernel as I recompiled it. Futhermore, I included the BT modules as builtin as explained… they are correctly loaded.

If I remove SDIO modules:

CONFIG_BT_MRVL_SDIO=y
CONFIG_BT_HCIBTSDIO=y

I am able to attach on UART bus but still no BT module detected:

nvidia@cam5-71995:~$ 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 INIT RUNNING 
	RX bytes:0 acl:0 sco:0 events:0 errors:0
	TX bytes:12 acl:0 sco:0 commands:3 errors:0
	Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
	Packet type: DM1 DH1 HV1 
	Link policy: 
	Link mode: SLAVE ACCEPT

By comparing with devkit, I see that service nvwifibt is not running but not sure if really required:

nvidia@cam5-71995:~$ sudo systemctl start nvwifibt.service
Job for nvwifibt.service failed because the control process exited with error code. See "systemctl status nvwifibt.service" and "journalctl -xe" for details.
nvidia@cam5-71995:~$ sudo journalctl -fu nvwifibt.service
-- Logs begin at Wed 2019-07-17 16:49:39 CEST. --
Jul 17 17:00:03 cam5-71995 systemd[1]: Starting NVIDIA bluetooth/wifi init script...
Jul 17 17:00:03 cam5-71995 nvwifibt-pre.sh[1334]: /etc/systemd/nvwifibt-pre.sh: line 57: stop: command not found
Jul 17 17:00:03 cam5-71995 systemd[1]: nvwifibt.service: Control process exited, code=exited status=1
Jul 17 17:00:03 cam5-71995 systemd[1]: Failed to start NVIDIA bluetooth/wifi init script.
Jul 17 17:00:03 cam5-71995 systemd[1]: nvwifibt.service: Unit entered failed state.
Jul 17 17:00:03 cam5-71995 systemd[1]: nvwifibt.service: Failed with result 'exit-code'.

Re,

I see a difference between dtb’s.

Devkit version I find a: /proc/bluetooth directory but not on our custom board.

Devkit:

nvidia@tegra-ubuntu:/sys/module/bluetooth$ ls
coresize  holders  initsize  initstate  notes  parameters  refcnt  sections  srcversion  taint  uevent  version

On custom board:

nvidia@cam5-71995:/sys$ ls /sys/module/bluetooth/
parameters  uevent  version

Hi,

Finally, I found that BLUEDROID_PM module was missing and is needed for BT to work.