iPhone fails to reconnect via Bluetooth after reboot

Hi everyone,

I have a Dahlia v1.1B board with the Verdin iMX8M Mini Quad 2GB WB IT V1.1B module. The image I am using is the Toradex Embedded Linux Reference Multimedia Image 7.0.0+build.1 (2024-10-01).

I configured Bluetooth using bluetoothctl and paired the iPhone successfully. However, after rebooting, when I try to reconnect, I get the following error:

[bluetooth]# connect XX:XX:XX:XX:XX:XX  
Attempting to connect to XX:XX:XX:XX:XX:XX  
hci0 XX:XX:XX:XX:XX:XX type BR/EDR connected eir_len 17  
[CHG] Device XX:XX:XX:XX:XX:XX Connected: yes  
Request confirmation  
[agent] Confirm passkey 160695 (yes/no): yes  
hci0 XX:XX:XX:XX:XX:XX type BR/EDR disconnected with reason 3  
[CHG] Device XX:XX:XX:XX:XX:XX Connected: no  

Then, when I try to connect from the iPhone, I see this log:

 bluetoothctl
hci0 new_settings: powered connectable discoverable bondable ssp br/edr le secure-conn
Agent registered
[CHG] Controller EC:2E:98:86:B0:76 Pairable: yes
hci0 XX:XX:XX:XX:XX:XX type BR/EDR connected eir_len 22
[CHG] Device XX:XX:XX:XX:XX:XX Connected: yes
hci0 XX:XX:XX:XX:XX:XX type BR/EDR disconnected with reason 3
[CHG] Device XX:XX:XX:XX:XX:XX Connected: no

I need to reconfigure the connection for it to work again.

I’ve also noticed this error in the logs after trying to reconnect using the dmesg command:

[   10.462055] Bluetooth: hci0: Invalid link address type 1 for XX:XX:XX:XX:XX:XX

Additionally, when using btmon, I can see the following logs during the connection attempt, which indicate the issue:

> HCI Event: Link Key Request (0x17) plen 6                                                        #80 [hci0] 14.719942
        Address: XX:XX:XX:XX:XX:XX (Apple, Inc.)
< HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6                                #81 [hci0] 14.720320
        Address: XX:XX:XX:XX:XX:XX (Apple, Inc.)
> HCI Event: Command Complete (0x0e) plen 10                                                       #82 [hci0] 14.723366
      Link Key Request Negative Reply (0x01|0x000c) ncmd 1
        Status: Success (0x00)
        Address: XX:XX:XX:XX:XX:XX (Apple, Inc.)
> HCI Event: Link Key Request (0x17) plen 6                                                        #83 [hci0] 14.825783
        Address: XX:XX:XX:XX:XX:XX (Apple, Inc.)
< HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6                                #84 [hci0] 14.826157
        Address: XX:XX:XX:XX:XX:XX (Apple, Inc.)
> HCI Event: Command Complete (0x0e) plen 10                                                       #85 [hci0] 14.830207
      Link Key Request Negative Reply (0x01|0x000c) ncmd 1
        Status: Success (0x00)
        Address: XX:XX:XX:XX:XX:XX (Apple, Inc.)
> HCI Event: Disconnect Complete (0x05) plen 4                                                     #86 [hci0] 15.878774
        Status: Success (0x00)
        Handle: 1 Address: XX:XX:XX:XX:XX:XX (Apple, Inc.)
        Reason: Remote User Terminated Connection (0x13)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                             {0x0002} [hci0] 15.879154
        BR/EDR Address: XX:XX:XX:XX:XX:XX (Apple, Inc.)
        Reason: Connection terminated by remote host (0x03)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                             {0x0001} [hci0] 15.879154
        BR/EDR Address: XX:XX:XX:XX:XX:XX (Apple, Inc.)
        Reason: Connection terminated by remote host (0x03)

Interestingly, when I test with an Android phone, the connection works fine without issues. However, I’m having trouble with the iPhone.

Has anyone encountered this issue with iPhones? I’m concerned the pairing is not preserved properly after reboot.

Thanks for your help!

Best regards,
Ferran

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 Ferran,

Thank you for reaching out with your Bluetooth connectivity issue. It sounds like you’re experiencing a frustrating problem with your iPhone not reconnecting after a reboot, especially since it works fine with an Android device. Let’s go through some steps that might help resolve this:

  1. Check Bluetooth Configuration Persistence: Ensure that the Bluetooth pairing information is saved correctly. You can verify this by checking the configuration files in /var/lib/bluetooth/ to see if your iPhone’s pairing information is still present after a reboot.

  2. Bluetooth Service Status: Make sure the Bluetooth service is starting correctly on boot. You can check its status with:

    systemctl status bluetooth
    

    If it’s not active, enable and start it using:

    systemctl enable bluetooth
    systemctl start bluetooth
    
  3. Bluetoothctl Agent Setup: Ensure the bluetoothctl agent is running and set to automatically accept pairing requests. You can do this by executing:

    bluetoothctl
    agent on
    default-agent
    
  4. HCI Device Configuration: The error “Invalid link address type” might indicate an HCI configuration issue. Try resetting the HCI device with:

    hciconfig hci0 reset
    
  5. Update Kernel and Firmware: Check for any available updates for the kernel or Bluetooth firmware that might improve compatibility with iOS devices.

  6. Use btmon for Debugging: Capture detailed logs during the connection attempt using btmon. This can provide more insights into the reconnection process.

  7. Compatibility Considerations: Since the connection works with Android but not iOS, there might be specific compatibility issues with iOS devices. It’s worth checking for any known issues related to iOS Bluetooth connectivity.

I hope these steps help you resolve the issue with your iPhone’s Bluetooth reconnection. If you have any further questions, feel free to ask.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

NXP i.MX 8M Mini / Nano - Verdin System on Module.

Hello @ferranmc,

We will try to reproduce this issue and send an update here.

Best Regards,
Bruno

Hello @ferranmc,

We were not able to reproduce the issue with the default Reference Multimedia Image 7.0.0.

What was the procedure to connect to the device?
I think it is possible that you did not trust the device with bluetoothctl.

A valid procedure here would be to:

  • Pair to the device
  • Trust the device
  • Connect to the device

Also, please note that the following log indicates that the iPhone is terminating the connection:

hci0 XX:XX:XX:XX:XX:XX type BR/EDR disconnected with reason 3

Therefore, it would be possible that the phone is not seeing use for the device and is disconnecting from it.

Best Regards,
Bruno

Hi bruno.tx,

Thank you for your response.

I followed the correct procedure to connect to the device using bluetoothctl as you described:

Pair to the device:
pair XX:XX:XX:XX:XX:XX

Trust the device:

trust XX:XX:XX:XX:XX:XX 

Connect to the device:

connect XX:XX:XX:XX:XX:XX 

After this, the device pairs, connects, and works without issues.

However, the problem occurs after rebooting the board. When I try to reconnect to the previously paired device, I encounter the error I mentioned. To make it work again, I have to repeat the pairing and connection process manually.

The phone I’m testing with is an iPhone SE running iOS 15.8.3.

Regarding the log indicating that the iPhone is terminating the connection (disconnected with reason 3), it is strange because the iPhone works fine with other Bluetooth devices, and I only observe this behavior with this setup.

Do you have any suggestions for preserving the pairing and avoiding this issue after rebooting the board?

Best regards,
Ferran

Hello @ferranmc,

This should work with your current configuration.

Maybe this is an issue that only occurs when pairing with this specific iOS version.
We tested with an iPhone 14 running iOS 18.
Do you have another iPhone available to test this with?
If so, it would help to narrow down which combinations of hardware cause such issues.

Best Regards,
Bruno

Hello Bruno,

I made a mistake with the version I mentioned earlier. I am actually testing with the BSP monthly release version: Verdin-iMX8MM Reference-Multimedia-Image 7.1.0-devel-202412+build.4, and this is the one causing the issue.

I also tested with Toradex Embedded Linux Reference Multimedia Image 7.0.0+build.1 (2024-10-01), and it works correctly.

Could you test this with BSP 7.1.0 and let me know how to resolve the issue in this version?

Best regards,
Ferran

Hello @ferranmc,

Thanks for the clarification.
Maybe there is a regression in the monthly image, we will look into it and send updates here.

Best Regards,
Bruno

Hello @ferranmc,

We were able to confirm the problem on the Monthly pre-release 7.1.0-202412.
Thanks for bringing this up, we will look into what is the cause of the problem.
For now, I would recommend that you stick with 7.0.0 if possible.

Best Regards,
Bruno

Hello @ferranmc,

Upon further investigation of the problem, it is caused by BlueZ 5.72.
BlueZ 5.79 can be used instead and it does not have such issue.

This will be fixed in upcoming releases of the Linux BSP.
For now, the recommendation is to keep using BSP 7.0.0 until this is fixed.

Best Regards,
Bruno