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

DFU from application

Hello Expert,

I am using SDK 6.1 and Softdevice 7.1.0 (s110) for our 256K/32K nrf51822 platform. As of now I wanna port DFU feature into our project. Of course, when burnt with bootloader, nRF toolbox can find device and upgrade application correctly. But you know, I dont wanna add DFU service in my application since the limitted flash memeory size and extra BLE power consuming. if so, please guide me how to enter DFU mode in my application. AFAIK, I must handle uncompleted flash operation and ble disconnection, right? And then, any points to be shared with me? Directly excute NVIC_SystemReset? But how does bootloader know it's from DFU not WDT or power-up?

Another question I found is that when my Android phone installed both nRF toolbox and nRF UART application, DFU APP cannot connect nrf51822 DFU service, it will disconnect unexpectedly in a very short time. My Android version is Lollipop. Any clues?

Thanks, Alex

Parents
  • Hi Alex, You can set the GPREGRET retention register before you call NVIC_SystemReset() and then in the bootloader you can check if the correct flag is written to GPREGRET you can enter bootloader mode. Please have a look at section C in this FAQ.

    Regarding the issue with nRFToolbox and nRFUART, could you make sure you have un-pair the device, and also try to turn off and on Bluetooth ? This is to make sure the ATT table cache is cleared. In your application and in the bootloader, you should also set IS_SRVC_CHANGED_CHARACT_PRESENT to 1.

Reply
  • Hi Alex, You can set the GPREGRET retention register before you call NVIC_SystemReset() and then in the bootloader you can check if the correct flag is written to GPREGRET you can enter bootloader mode. Please have a look at section C in this FAQ.

    Regarding the issue with nRFToolbox and nRFUART, could you make sure you have un-pair the device, and also try to turn off and on Bluetooth ? This is to make sure the ATT table cache is cleared. In your application and in the bootloader, you should also set IS_SRVC_CHANGED_CHARACT_PRESENT to 1.

Children
  • Hi Hung, thanks for your answer. You know, my application has no DFU service but bootloader has. As your suggestion, when I do use retention register to force a NVIC softreset, the bootloader will advertise a new DFU service to central. Do you mean I should set IS_SRVC_CHANGED_CHARACT_PRESENT to 1 both for application and bootloader? Seen from FAQ, seems I should share bonded information to bootloader, but if not, how Android app reconnect with this DFU servive? As I tested on my Android phone with nRF tooblox, is this the reason why I can see DFU device but when trying to connect, the connection is closed in a short time?

  • BTW, except the nrf51 device, i am also developing Android's application like nrf toolbox for my device. So please show me how to deal with my case, that is, nrf application has no DFU but force a NVIC_SystemReset, but bootloader has DFU. Is it enough that i just set IS_SRVC_CHANGED_CHARACT_PRESENT=1? How does Android Java code clear ATT cache without manually using settings?

Related