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

DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application

Hi,

I am developing some DFU OTA firmware for nRF51822, QFAAH0 (v3 silicon, 256kB ROM, 16kB flash), on a custom board, using SD110v8. Both my application and bootloader were adapted from the Keil pack examples.

I am experiencing a funny behaviour using the android nrftoolbox app to perform dfu. The dfu is initiated from the application (not the bootloader).

I believe, the standard procedure is as follows, nrftoolbox tells the device to restart and enter bootloader mode, the device will restart in bootloader and re-advertise itself. nrftoolbox will reconnect to the device which is now in bootloader to continue the update.

My problem is, when I have my own bootloader and application programmed, after I press the UPLOAD button in nrftoolbox, the device will restart itself (enters bootloader mode). However the app does not reconnect to the device, instead it gets stuck in "Connecting..." and eventually timeout. Since now the device is in bootloader, I can press the UPLOAD button again and the dfu will continue without any further issues.

After a bit of debugging, I also discovered that, if I use the sample bootloader + my own application, the dfu process has no issues.

At first glance, this may be an issue in my own bootloader, however, after commenting out almost all of my modifications to the bootloader (so it is pretty much identical to the sample bootloader), nrftoolbox still cannot reconnect once the device is in bootloader mode. Additionally, I can still perform dfu using my bootloader, so the bootloader is PROBABLY working fine. The only problem is nrftoolbox does not reconnect to it, if i initiated dfu from the application.

My question is, how does nrftoolbox handle reconnection to the device when the dfu process is initiated from the application. I suspect that with my own bootloader + application, nrftoolbox cant identify the correct device to reconnect to and continue with the dfu.

Thanks in advance, Mike

Parents
  • Hi Mike,

    I suspect that you didn't configured your project to have NoInit RAM section to preserve the peer data from application when switching to bootloader. You can quickly check this by checking the Bluetooth address of your DFU bootloader after it switch from application to bootloader. If it's not the same as your application's but your application address +1, then it's most likely the issue I suspecting.

    Configuration for dfu_ble_svc.c needed:

    image description

  • @Mike: sorry for that late response, I was on vacation.

    "how does the application decide where to put the peer data?": The application doesn't do the work to put data to the No-int area, it's the SVC call dfu_ble_svc_set_peer_data() that will jump to dfu_ble_set_peer_data in the bootloader code. In side that dfu_ble_set_peer_data() it will copy the data from source (m_peer_data from application) to destination (no-init area).

    I'm not sure why the SVC call didn't work or it couldn't modify the No-init RAM area. If possible please send me your bootloader project file, I can try to reproduce the issue here.

Reply
  • @Mike: sorry for that late response, I was on vacation.

    "how does the application decide where to put the peer data?": The application doesn't do the work to put data to the No-int area, it's the SVC call dfu_ble_svc_set_peer_data() that will jump to dfu_ble_set_peer_data in the bootloader code. In side that dfu_ble_set_peer_data() it will copy the data from source (m_peer_data from application) to destination (no-init area).

    I'm not sure why the SVC call didn't work or it couldn't modify the No-init RAM area. If possible please send me your bootloader project file, I can try to reproduce the issue here.

Children
No Data
Related