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

  • Hi Hung, I think I finally fully understand what you mentioned earlier, regarding the address +1 issue. I did a bit of debugging and found that the MAC address agrees exactly for each of the 5 steps you talked about, if im using the default codes. In particular, in step 4, the advertising name is actually n/a and the MAC address is A (not A+1).

    So this means, in my own bootloader, somehow the reset didnt work as expected. Would you have any suggestion in where to look for potential causes for the A+1 issue in Step 4? I'm certain that the NoInit button is ticked for the last 0x80 bytes of RAM. And my RAM layout is as follows:

    • IRAM1 0x20002000 0x1F80
    • IRAM2 0x20003F80 0x0080 NoInit

    Also, FYI, the reason why I did my own DFU bootloader is I wanted to have both BLE and Serial, hence I have separated out many .c and .h files from the PACK, these are:

    • bootloader.c
    • bootloader_settings_arm.c
    • bootloader_util_arm.c
    • dfu_dual_bank.c
    • dfu_init_template.c
    • dfu_transport_ble.c
    • dfu_transport_serial.c
    • hci_mem_pool.c
    • hci_slip.c
    • hci_transport.c

    All other required source files are from the Keil PACKS.

    Thanks a lot for your time again. Mike.

Reply
  • Hi Hung, I think I finally fully understand what you mentioned earlier, regarding the address +1 issue. I did a bit of debugging and found that the MAC address agrees exactly for each of the 5 steps you talked about, if im using the default codes. In particular, in step 4, the advertising name is actually n/a and the MAC address is A (not A+1).

    So this means, in my own bootloader, somehow the reset didnt work as expected. Would you have any suggestion in where to look for potential causes for the A+1 issue in Step 4? I'm certain that the NoInit button is ticked for the last 0x80 bytes of RAM. And my RAM layout is as follows:

    • IRAM1 0x20002000 0x1F80
    • IRAM2 0x20003F80 0x0080 NoInit

    Also, FYI, the reason why I did my own DFU bootloader is I wanted to have both BLE and Serial, hence I have separated out many .c and .h files from the PACK, these are:

    • bootloader.c
    • bootloader_settings_arm.c
    • bootloader_util_arm.c
    • dfu_dual_bank.c
    • dfu_init_template.c
    • dfu_transport_ble.c
    • dfu_transport_serial.c
    • hci_mem_pool.c
    • hci_slip.c
    • hci_transport.c

    All other required source files are from the Keil PACKS.

    Thanks a lot for your time again. Mike.

Children
No Data
Related