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

Application service UUID gone after secure OTA DFU

Hello, 

I am using nRF52832 on SES v4.12 with SDK v15.3 and SD v6.1.1 on a custom board.

Background: 

I want to perform OTA DFU and with that i have two services enabled (secure dfu buttonless and NUS). I was facing OTA DFU issue in which i was getting CRC does not match error. This has been resolved here - https://devzone.nordicsemi.com/f/nordic-q-a/55653/dfu-crc-does-not-match-error

So, i have been able to perform OTA update. 

The package that i created includes BL+SD+APP. 

Problem: 

Once i perform the update and connect again, i only see one service, which is Secure DFU service and the other which is the main application service ID (NUS) is gone. I looked in the forum and found this -https://devzone.nordicsemi.com/f/nordic-q-a/39982/after-ota-dfu-bootloader-application-gone

But i do not quite fully understand as to what is to be done here. Could you please highlight on what is required for a proper DFU process? From what i understand from the post and infocenter that it is still a single update, so BL+SD+APP merged together should work fine internally. 

EDIT:

Zip created has only application hex in it. BL+SD+APP is programmed directly using nrfjprog. 

Please let me know if you require more information. 

Thanks a lot!

-SK

Parents
  • After successful dfu the new application should be started. The services available after an update depend on what you have in it. If there's only Secure dfu service, than it's either the buttonless service (check characteristic name in nRF Connect for Android) which means that your have flashed an app without NUS, or you're still in bootloader mode, that is the app has been rejected by the new bootloader do for some reason. The old app has been removed, a specially if SD's major version has changed, to make space for dual bank.

    In nRF Connect it may also be that another tab opened, with the bootloader address. Just close it and use the tab with your old device name. You may also clear cache, select Refresh services in the menu after connecting to your device.

  • I migrated the SDK from 14.2 to 15.3. In v14.2, this DFU process worked fine. That means i have both the services running after DFU process and yes, there was another tab that opened with the bootloader address. 

    But with 15.3, i donot see such a thing. SD major is still 132 that i am using with v6.1.1. 

    I ran nrfjprog --eraseall before programming the module with merged hex (BL+SD+APP) and then did a reset. Till here, application runs fine. I can see both the services on the nRF Connect. It is only when i try to update the application (creating a package) via OTA DFU, that i see the problem. When i try to connect, i see only Secure DFU service and not the other one. Not sure whats going on :(  

  • @SK: The issue regarding the MTU request is fixed in SDK v16.0 but not on SDK v15.3 you may want to follow my suggestion in the case. 

  • Okay sure, will do. In that case, you say putting in a timer to delay the MTU exchange? When should the timer expire? Could you tell me more on the details, please.  

  • The main reason to delay MTU exchange was to wait for the phone to do that. (so that we have larger MTU ATT). I would say give it 1-2 second. 

    Regarding the issue of having sd_ble_gatts_service_changed() and sd_ble_gattc_exchange_mtu_request() at the same time, you can check if the error is NRF_ERROR_INVALID_STATE the application can retry after a certain time (let's say 1 second) . 

  • Hi

    Sorry, i had to move to some other tasks. I tried to do as you suggested, but i am getting error on the sd_ble_gattc_exchange_mtu_request() --> unknown error code 

    Would you know why would that be? I have added timer as below.

        if (p_link->att_mtu_desired > p_link->att_mtu_effective)
        {
            NRF_LOG_DEBUG("Requesting to update ATT MTU to %u bytes on connection 0x%x.",
                          p_link->att_mtu_desired, conn_handle);
            create_mtu_request_timer();
            app_timer_start(mtu_request_delay_timer, APP_TIMER_TICKS(1000), NULL);
        }

    Rest of the code i have moved in the handler:

    static void request_delay_handler(void *p_context)
    {
      ret_code_t err_code;
      nrf_ble_gatt_t * p_gatt = (nrf_ble_gatt_t *)p_context;
      ble_evt_t const * p_ble_evt;
      uint16_t  conn_handle = p_ble_evt->evt.common_evt.conn_handle;
      nrf_ble_gatt_link_t * p_link      = &p_gatt->links[conn_handle];
        err_code = sd_ble_gattc_exchange_mtu_request(conn_handle, p_link->att_mtu_desired);
    
        if (err_code == NRF_SUCCESS)
        {
            p_link->att_mtu_exchange_requested = true;
        }
        else if (err_code == NRF_ERROR_BUSY)
        {
            p_link->att_mtu_exchange_pending = true;
            NRF_LOG_DEBUG("sd_ble_gattc_exchange_mtu_request()"
                          " on connection 0x%x returned busy, will retry.", conn_handle);
        }
        else
        {
            NRF_LOG_ERROR("sd_ble_gattc_exchange_mtu_request() returned %s.",
                          nrf_strerror_get(err_code));
        }  
    }

    Once i connect, i get this error: 

    <error> nrf_ble_gatt: sd_ble_gattc_exchange_mtu_request() returned Unknown error code.

  • Okay, got it what i was doing wrong there! 

    will continue to check on the DFU procedure now. 

Reply Children
No Data
Related