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

nRF DFU works only in using SES, not after nrfjprog programming

Hello,

SDK 15.2.0

SoftDevice 6.1.0

DFU with Uart (based on {SDK}\examples\dfu\secure_bootloader\pca10040_uart. Single bank mode as my app is quite big (probably not relevant in the current issue).

I will update the nRF using a STM32 controller, so I have developped the controller protocol and it seems now OK (despite my issue).

What is working :

I program the SD and my App using nRFGo. I build the setting.hex of my app for bootloader and program it. Then I launch the bootloader using SES. It first go to app (DFU not started and valid app is available) and I launch DFU mode using BUTTON mode of the DFU (which is in fact a GPIO handle by the STM32). It enter DFU mode, it set PRN, get MTU, send Init Packet, and the new Application. And now the new app is working.

What is not working:

I program the SD and App using nRFGo. I program the bootloader_setting hex file using nrfjprog (mergehex between the two file). I launch the code. It launch the app at start. Then I enter in DFU mode the same way. I set the PRN and I did get a success answer. Then any coming command is not answer to the controller. get MTU, or reset PRN, create object, ... none of those command are answer. After a while inactivity trigger a reset and go back to the app.

Here is the script I am using for the programming, no error occurs during the programming.

nrfutil settings generate --family NRF52 --application application.hex --application-version 3 --bootloader-version 2 --bl-settings-version 1 settings.hex
mergehex -m bootloader.hex settings.hex -o bootloader_settings.hex
nrfjprog --family NRF52 --program bootloader_settings.hex --sectoranduicrerase --verify
nrfjprog --family NRF52 --reset

But as this is completly repeatable, I may I miss something in the process.

Hope you can help.

Parents
  • Hi Stephane, 

    I strongly recommend that you use nrfjprog directly or the new Programmer app in our nRF Connect for Desktop to program the application and SoftDevice. nRFGo Studio is deprecated for the nRF52 series. 

    How do you program the setting.hex in the first scenario if you're not using nrfjprog?

    Also you state:

    Then I launch the bootloader using SES.

    Do you mean that you start a debug session?

    I cant see any issues with the nrfjprog commands, 

    Can you try to flash the softdevice and appplication using nrfjprog before you flash the bootloader and also replace the --sectoranduicrerase with --sectorerase?

    Best regards

    Bjørn

     

     

  • "How do you program the setting.hex in the first scenario if you're not using nrfjprog?" => You're right, I was using nrfjprog for this step, but without merging with the bootloader.

    "Do you mean that you start a debug session?" => Yes, but in release build.

    First I only use --sectorerase, but return a warning for the UIC segment that require to be rewritten (i guess to update the start address). In both case, the bootloader does not answer after the first command. What do you think about the printf I forgot to remove ? can it explain the problem ?

    I will change nRFGo for nRF Connect.

Reply
  • "How do you program the setting.hex in the first scenario if you're not using nrfjprog?" => You're right, I was using nrfjprog for this step, but without merging with the bootloader.

    "Do you mean that you start a debug session?" => Yes, but in release build.

    First I only use --sectorerase, but return a warning for the UIC segment that require to be rewritten (i guess to update the start address). In both case, the bootloader does not answer after the first command. What do you think about the printf I forgot to remove ? can it explain the problem ?

    I will change nRFGo for nRF Connect.

Children
  • Didnt see your first comment when I wrote my reply. 

    Yes, a reference to printf with the logging module disabled could lead to unwanted behaviour, so I would remove it/comment it out and then see if it helps.  However, then you should see the nRF asserting in the debug session as well I would think.

    You can flash the Softdevice first with the --chiperase option and then you should only have to use --sectorerase when flashing the bootloader mergerd with the settings hex using sectorerase(which isnt strictly needed since you have run a chiperase when flashing the SD). 

Related