This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

iOS BLE not showing passcode popup

Hi Guys,

I need to connect to a BLE device using NRF52480 using passcode (6 digit pincode)

on Android it works just fine, I attempt to connect and displays the popup for entering the code.

on iOS nothing happens, I can only see the UART service and cannot connect.. I also tried to read, write, subscribe to the cccd but nothing happens.

I have tried to discover services but I cannot because I am not connected... (see logs below)

I have searched everywhere and in all related question in Nordic Q&A forum and couldn't find any solution for my issue.
I have also checked the glucose example you provided and it failed.

This is very urgent for my company and I need to get this working ASAP. Please help me

I am using iPhone 11 with iOS 14.4

Is there a specific configuration that you know of that I need to set in the peripheral in order for it to work? I have tried a lot of combinations with no success.

I get the following errors on the mobile side:


discoverServices, ERROR: PlatformException(flutter_reactive_ble.Central.(unknown context at $1079e3cf0).Failure:1, The operation couldn’t be completed. (flutter_reactive_ble.Central.(unknown context at $1079e3cf0).Failure error 1.), {}, null)


flutter: readCharacteristic, err: Exception: GenericFailure<CharacteristicValueUpdateError>(code: CharacteristicValueUpdateError.unknown, message: "A peripheral F4A9ECC7-D985-E28A-18F6-9C35F931679A is unknown (make sure it has been discovered)")


flutter: readCharacteristic, err: Exception: GenericFailure<CharacteristicValueUpdateError>(code: CharacteristicValueUpdateError.unknown, message: "A peripheral F4A9ECC7-D985-E28A-18F6-9C35F931679A is unknown (make sure it has been discovered)")

Best regards,

Asaf

Parents
  • Hello,

    Try forgetting the device from the phone's settings.

    If you want the devices to pair using a passcode, you should have at least one characteristic that requires encryption with MITM protection. Have you specified this in one of your characteristics?

    Also make sure to delete the bonding information on the nRF. The easiest way to do that is to erase the chip using "nrfjprog --eraseall" (nRF Command Line Tools) and re-programming it.

    What may happen is that the phone was connected to this device earlier, and discovered and cached the services. If you added a service later, it may still think it only has the original services. Phones act a bit different on how long they keep this data. An easy way to check if this is the issue is to test with another phone and see if you get the same issue. Then try to erase the service data by forgetting the device. To be sure, you can also try to completely turn off the Bluetooth on the phone from the phones settings (not just the "drag up menu", which doesn't really turn the bluetooth off. It rather turns off some of the functionality. You will note that it is only whited out, and not turned off, as if you disable it from the settings).

    See if that helps, and let me know if it doesn't.

    Best regards,

    Edvin

  • Hi Edvin, thanks for the reply.

    The Rx/Tx characteristics are with MITM. The iPhone cannot discover these services. on Android I can see them without connecting


    The UART contains the 2 characteristics with the MITM.

    The Ble device is waiting for passcode, but when I attempt to connect using the iPhone nothing happens.. when I try to read, write or do anything it throws the errors from original post.

    We are also forgetting the bonding information, (pm_peers_delete)

    Do you have any idea what can go wrong? Where can we get an example of the configuration required for iPhone device to know that we require a passcode for bonding?

    Asaf

  • Hello Asaf, 

    Did you try to delete the phones BLE cache as described in my initial reply?

     

    Edvin said:
    Phones act a bit different on how long they keep this data. An easy way to check if this is the issue is to test with another phone and see if you get the same issue. Then try to erase the service data by forgetting the device. To be sure, you can also try to completely turn off the Bluetooth on the phone from the phones settings (not just the "drag up menu", which doesn't really turn the bluetooth off. It rather turns off some of the functionality. You will note that it is only whited out, and not turned off, as if you disable it from the settings).

     I am still not convinced the phone is seeing the nRF as a new device that needs service discovery.

    Another way to force service discovery is to change the BLE address to force the phone to think it is a new device. For debugging purposes, you can try to do this from your application after initializing the ble_stack, but before you start advertising:

        ret_code_t err_code;
        
        ble_gap_addr_t my_addr;
        err_code = sd_ble_gap_addr_get(&my_addr);
        APP_ERROR_CHECK(err_code);
        
        NRF_LOG_INFO("my addr before changing: 0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x", my_addr.addr[0],
                                                                                            my_addr.addr[1],
                                                                                            my_addr.addr[2],
                                                                                            my_addr.addr[3],
                                                                                            my_addr.addr[4],
                                                                                            my_addr.addr[5]);
        my_addr.addr[0] = 0x01;
        
        err_code = sd_ble_gap_addr_set(&my_addr);
        APP_ERROR_CHECK(err_code);

    Just make sure to set my_addr.addr[0] to something it wasn't initially (printed in the log). 

    Whenever you need to force the phone to redo the service discovery, increment my_addr.addr[0].

    BR,

    Edvin

  • Hi,

    I've used Glucose example with increased security level and I've successfully initiated pin code connection with IOS.

    The issue is that in my application - I'm using 2 services - NUS and Device Information Service. With those two services - IOS doesn't initiate passkey popup, even when the security level is high (MITM). I don't need the Glucose in my application.

    Can you please help me?

    Thanks!

Reply
  • Hi,

    I've used Glucose example with increased security level and I've successfully initiated pin code connection with IOS.

    The issue is that in my application - I'm using 2 services - NUS and Device Information Service. With those two services - IOS doesn't initiate passkey popup, even when the security level is high (MITM). I don't need the Glucose in my application.

    Can you please help me?

    Thanks!

Children
Related