Colibri iMX7 hci0 problem with BSP 5

Hello everyone.

We have been using Colibri iMX7D EMMC SoM for a long time in our products. As a wireless module we have been using RS9116N from Redpine (Silicon Labs Now) on SDIO port

Simply by enabling them on menuconfig of kernel the modules become available and our interface for WiFi comes up however we have problems with bluetooth

Just to have a good and simple comparison I built two images.

one with dunfel (where we have to work at the moment)

repo init -u git://git.toradex.com/toradex-manifest.git -b dunfell-5.x.y -m tdxref/default.xml

one with scarthcap

repo init -u git://git.toradex.com/toradex-manifest.git -b scarthgap-7.x.y -m tdxref/default.xml

in both builds I only modified the menuconfig to enable support for RSI Wifi/BT module and
built tdx-reference-minimal-image

On 7.x.y build (Kernel 6.6) bluetooth interface comes up without any problem

However with 5.x.y build (Kernel 5.4) we get an error bringing up the hci0 interface

root@colibri-imx7-emmc-06476817:~# rfkill list
0: hci0: bluetooth
        Soft blocked: yes
        Hard blocked: no
1: phy0: wlan
        Soft blocked: yes
        Hard blocked: no
root@colibri-imx7-emmc-06476817:~# rfkill unblock all
root@colibri-imx7-emmc-06476817:~# [   29.516728] rsi_91x: ===> Interface UP <===
[   29.521897] rsi_91x: rsi_disable_ps: Cannot accept disable PS in PS_NONE state
[   29.538838] rsi_91x: rsi_disable_ps: Cannot accept disable PS in PS_NONE state

root@colibri-imx7-emmc-06476817:~#
root@colibri-imx7-emmc-06476817:~# hciconfig
hci0:   Type: Primary  Bus: SDIO
        BD Address: 8C:6F:B9:B6:A9:C6  ACL MTU: 1021:3  SCO MTU: 64:3
        DOWN
        RX bytes:539 acl:0 sco:0 events:25 errors:0
        TX bytes:0 acl:0 sco:0 commands:25 errors:0

root@colibri-imx7-emmc-06476817:~# hciconfig hci0 up
[   43.064623] debugfs: File 'dut_mode' in directory 'hci0' already present!
Can't init device hci0: Invalid request code (56)
root@colibri-imx7-emmc-06476817:~# dmesg | grep -i "hci"
[    1.084789] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.093296] ehci-mxc: Freescale On-Chip EHCI Host driver
[    1.100763] ehci-fsl: Freescale EHCI Host controller driver
[    1.137509] ci_hdrc ci_hdrc.0: EHCI Host Controller
[    1.176310] ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
[    1.315034] sdhci: Secure Digital Host Controller Interface driver
[    1.322803] sdhci: Copyright(c) Pierre Ossman
[    1.328691] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.337667] sdhci-esdhc-imx 30b40000.usdhc: Got CD GPIO
[    1.377333] mmc1: SDHCI controller on 30b40000.usdhc [30b40000.usdhc] using ADMA
[    1.424938] mmc0: SDHCI controller on 30b60000.usdhc [30b60000.usdhc] using ADMA
[    5.609802] Bluetooth: HCI device and connection manager initialized
[    5.646377] Bluetooth: HCI socket layer initialized
[   43.064623] debugfs: File 'dut_mode' in directory 'hci0' already present!
root@colibri-imx7-emmc-06476817:~# dmesg | grep -i "bluetooth"
[    5.563673] Bluetooth: Core ver 2.22
[    5.609802] Bluetooth: HCI device and connection manager initialized
[    5.646377] Bluetooth: HCI socket layer initialized
[    5.665970] Bluetooth: L2CAP socket layer initialized
[    5.704076] Bluetooth: SCO socket layer initialized
[    7.496971] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    7.503714] Bluetooth: BNEP filters: protocol multicast
[    7.510370] Bluetooth: BNEP socket layer initialized

Since then I also tried a bluetooth USB dongle from the market and had the same problem

Thanks everyone in advance for the ideas!

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello there!

To address your Bluetooth issue on the Toradex device, here are some steps you can follow:

  1. Verify the Bluetooth Service: Ensure that the Bluetooth service is running properly by executing the following command:

    systemctl start bluetooth.service
    
  2. Enable Bluetooth with ConnMan: Use ConnMan to enable Bluetooth:

    connmanctl enable bluetooth
    
  3. Check Bluetooth Device Status: Use hciconfig to check the status of your Bluetooth device:

    hciconfig
    

These steps should help you get started with troubleshooting your Bluetooth issue. If the problem persists, it might be related to specific configurations or issues with the RS9116N module on BSP 5.x.y. In such cases, reviewing the device logs and configurations might provide further insights.

I hope this helps you resolve the issue!

Best regards,
Toradex AI Assistant.

Hello @fahri,

Since Kernel 5.4 there have been many fixes to the drivers involved here.
Therefore pointing out exactly what is wrong may not be that easy.
As BSP 5 is no longer maintained, the recommendation is to go to BSP 7, which is the latest one.

If that is not currently an option, there is another difference which may be relevant here.
On BSP 5, the default kernel used for the Colibri iMX7 was a downstream kernel, not a mainline one.
On BSP 6 onwards, the default kernel is mainline.
Therefore, you can try to use the mainline BSP 5 kernel and check if the same problem is present.

To do so:

  1. Initialize the build, using the last tag for BSP 5:
repo init -u git://git.toradex.com/toradex-manifest.git -b refs/tags/5.7.6 -m tdxref/default.xml
repo sync
  1. Set MACHINE to the correct machine
  2. Change DISTRO from tdx-xwayland to tdx-xwayland-upstream

Best Regards,
Bruno

Hello @bruno.tx

Thanks for the input! Yeah like I wrote in the first message I already tested this with BSP 7 and the bluetooth works there.

I followed your idea and build the image with DISTRO=tdx-xwayland-upstream. I see that this way the kernel that is built is a later version than ours. (5.4.264 instead of 5.4.193) and with tdx-reference-minimal-image hci0 interface came up!

Now I am stuck on the second step though… When I try to update my target with this zImage it hangs at this point

[ 2.320333] Waiting for root device /dev/mmcblk0p2...

This was not the case when I was rebuilding tdx-xwayland kernel, is there a difference with partitions?

Hello @fahri,

It is good to know that this got bluetooth to work.
Please note that the kernel has not only a greater version number, but is a very different kernel.
The one used previously was a downstream kernel based on NXP’s kernel, while the new one is an upstream kernel based on the upstream kernel.


If you are using a u-boot for the downstream image and trying to boot the upstream image, I think you may be running into an issue which is fixed by the following u-boot patch: 0001-colibri_imx7-boot-linux-kernel-in-non-secure-mode.patch « files « u-boot « recipes-bsp - meta-toradex-nxp.git - Toradex BSP layer, recipes for NXP based modules

I would recommend that you update both u-boot and Linux when using this new image so you ensure that the image has a compatible bootloader.
Is this a possibility for your use case?

Best Regards,
Bruno

Hello again Bruno

Thanks for the idea to update also the u-boot that took me a bit further on my image. However instead of updating the u-boot on the target I updated manually the tezi image to have the new u-boot and the kernel. It felt a bit dirty to do so but it brought results!

I wanted to ask you though. When I build boot2qt manifest for lts 5.15 LTS

repo init -u https://code.qt.io/yocto/boot2qt-manifest -m lts-5.15.xml

This also gives me downstream kernel. Here the DISTRO is b2qt, would you have a similar trick for it to build mainline kernel ?

Hello @fahri,

Adding the following to the end of the b2qt.conf file may be enough:

DISTROOVERRIDES .= ":upstream"
DISTRO_FLAVOUR = " (UPSTREAM)"

IMX_DEFAULT_BSP = "mainline"

IMAGE_BASENAME_append = "-upstream"

It is possible that with these changes the image is unbuildable, as this is not a validated configuration.

Best Regards,
Bruno