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

project with NUS prevents DFU from advertising

Nrf52/Kiel/SDK11

My application was at the point where I needed to add DFU. Following the examples and SDK doc, I added the files and code needed. It would NOT advertise. So I looked at the examples (eg Heartrate with dfu) and noticed the only difference was the NUS service. I removed it and the DFU finally advertised.

So I add the code back for the NUS and again, the DFU went away. Next, I switched the order of initialization in my serivces_init file, and it appears that the service that is initialized first is the one that gets to advertise.

Finally, I used the heart rate w/ DFU example and added the NUS service, and again, it would not advertise as long as it initialized after the DFU.

Any ideas?

Rich

Parents
  • The solution is you cant advertise to 32byte uuid's in the advertising packet. I got around this by removing all the dfu stuff from my main app, and adding a special write charac to the BAS Battery level. When I write a magic number to the charac, it sets NRF_POWER->GPREGRET = BOOTLOADER_DFU_START, prepare for reset, then NVIC_SystemReset(). This will reboot the device into the bootloader which will require mobile app to reconnect, but it works seamlessly to the user.

Reply
  • The solution is you cant advertise to 32byte uuid's in the advertising packet. I got around this by removing all the dfu stuff from my main app, and adding a special write charac to the BAS Battery level. When I write a magic number to the charac, it sets NRF_POWER->GPREGRET = BOOTLOADER_DFU_START, prepare for reset, then NVIC_SystemReset(). This will reboot the device into the bootloader which will require mobile app to reconnect, but it works seamlessly to the user.

Children
No Data
Related