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

NRF_ERROR_RESOURCES after upgrade to SDK 17

Hi,

I've upgraded my SDK from 15.2 to 17.

After upgrading - I can't connect my device via NFC - it keeps disconnect with NRF_ERROR_RESOURCES.

I've tried to increase BLE queue size, it didn't help.

Can you please help me?

Thanks!

  • I will try to give some more details - 

    The issue occurs when I'm trying to connect with BLE_GAP_IO_CAPS_DISPLAY_ONLY and NFC_PAIRING_MODE_LESC_OOB. When I work with BLE_GAP_IO_CAPS_NONE and NFC_PAIRING_MODE_JUST_WORKS - everything is OK.

    Again - everything it was OK when I used SDK 15, also with BLE_GAP_IO_CAPS_DISPLAY_ONLY  and NFC_PAIRING_MODE_LESC_OOB.

    I've noticed that in SDK 17 a lot of things were changed - BLE_GAP_EVT_LESC_DHKEY_REQUEST and stuff like that.

    Maybe that's the reason? Maybe I need to set some flags in order to work with secured BLE in SDK 17?

    Thanks!

  • Problem is solved - I didn't use nrf_ble_lesc_request_handler().

    I understand that this function computes keys for requested peers. Am I right?

    In addition - when should I call this function in my application? Only when I'm starting advertise?

    Thanks!

  • Hi 

    Good to hear that you found the issue Slight smile

    This function will start the Diffie Hellman key generation algorithm, that is correct. The reason it has to be called from the application is that this process is quite slow, and should not be called directly from an interrupt (such as an event handler), but from main context, so that it doesn't block other interrupts. 

    Essentially you should call this function as a part of your while loop in main, as you can see in the ble_app_hrs example in the SDK:

    /**@brief Function for handling the idle state (main loop).
     *
     * @details If there is no pending log operation, then sleep until next the next event occurs.
     */
    static void idle_state_handle(void)
    {
        ret_code_t err_code;
    
        err_code = nrf_ble_lesc_request_handler();
        APP_ERROR_CHECK(err_code);
    
        if (NRF_LOG_PROCESS() == false)
        {
            nrf_pwr_mgmt_run();
        }
    }

    Best regards
    Torbjørn

  • Hi

    The problem is that BLE connection is only a small part in my app, and I don't want it to calculate keys all the time. I don't want other parts in my app to be interrupted.

    Maybe it's better to use this function only when I want to establish a connection? Do I have that option?

    Thanks!

  • Hi 

    The only time this function actually does anything is whenever you first establish a connection and do the LESC pairing.

    Assuming you bond after pairing the devices will reuse the previously shared encryption keys every time they re-connect, so you don't have to do pairing for each connect. 

    So while it looks like this function is running all the time and using a lot of CPU resources, that is not actually the case (also keep in mind that you typically go to sleep at the end of the while loop to optimize current consumption, you don't run it continuously). 
    Most of the times this function is called it will return immediately without doing anything. 

    Best regards
    Torbjørn

Related