This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DFU Bootloader with S340 Softdevice

Hi, I learned how to replace the softdevice for a normal application. I've replaced 140 with 340 in my app. However I don't know to do that for the boolloader.

What I want to achieve is

- Have a BLE bootloader with S340

- Have my app on top, which will support the Buttonless DFU (next step)

For now I'm struggling to make the step 1 work. The example works when I use the S140, but when I replace with S340 it does not. I guess I don't have to change the the target addresses, because the bootloader goes to it's place no matter the softdevice, but what should be changed? Are there major differences between 140 and 340? I thought it was just an addition of ANT+? Maybe I just to need to midify some macros? 

Please help. Thanks

Parents
  • Hi,

    what should be changed? Are there major differences between 140 and 340?

    Assuming the S340 SoftDevice you are using is the same major version as the S140 version and you only use a BLE bootloader in both cases, the API etc. is the same (so not just the nrf_sdm.h file). This should be enough, though there could be something I do not think about which you should see when you test.

    Regarding memory, the bootloader is located at the end of the flash, so flash start address will not be a problem even if the SoftDevice increases. If the version is the same and you only use BLE still, the RAM configuration should also be good. Alternatively you could increase the bootloader RAM start address and decrees the size a bit just to be on the safe side (you will get a runtime error when configuring the SoftDevice if this is a problem, though).

  • Hi, Thanks for your answer. This part of my question is clear. Can you please address the other part (buttonless dfu app does not work). 

    What I can say in addition is that the app does not go into the ble_dfu_evt_handler. It just resets.

    PS: I also implemented parts of the power management example app into my app, which I think might be in conflict.

Reply
  • Hi, Thanks for your answer. This part of my question is clear. Can you please address the other part (buttonless dfu app does not work). 

    What I can say in addition is that the app does not go into the ble_dfu_evt_handler. It just resets.

    PS: I also implemented parts of the power management example app into my app, which I think might be in conflict.

Children
  • Hi,

    I did not see any questions related to buttonless other than the statement that you want to use it.

    dragilla said:
    What I can say in addition is that the app does not go into the ble_dfu_evt_handler. It just resets.

    If it "just resets" then something is resetting. An error handler perhaps? Have you attempted to make a debug build (with DEBUG defined) and logging enabled? If so, you should easily see that. Generally, the buttonless DFU mechamism is very simple, by just writing a magic work to GPREGREG and performing a soft reset. Then the bootloader checks GPREGRET for the magic word - and if it is present, it enters DFU mode.

  • I have it compiled with debug and I use RTT. There's nothing there :(

  • Your application or the bootloader? You need to build the _debug version of the bootloader, which has RTT logging. I also suggest you disable RTT logging in the application (if you use it) while testing this, as if not you can get problems with the RTT viewer (it searches for a n RTT buffer in memory, and if it finds the RTT buffer from the application before the bootloader that will be used, even though the bootloader may have it's RTT buffer located at a different place in RAM).

  • Ok. But it does not get to the bootloader... I think. I mean it does the first time, when there is no app. Then I can connect to it and upload a zip with my app. Next when I connect to my app and try the DFU it reboots back to my app. I will check what you wrote though. Thanks

  • Ok. It's like I said. When I turn off logging in my app, I can see logs from the bootloader, but they only show when I start app. Then I try to "start the DFU" it goes "initializing" and restarts... but I'm no loonger sure it does, because the log is silent from the moment the app started the first time.

    The log from the first boot below:

    00> <info> app: Inside main
    00> 
    00> <debug> app: In nrf_bootloader_init
    00> 
    00> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    00> 
    00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    00> 
    00> <debug> nrf_dfu_settings: Using settings page.
    00> 
    00> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    00> 
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00> 
    00> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    00> 
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00> 
    00> <debug> app: Enter nrf_bootloader_fw_activate
    00> 
    00> <info> app: No firmware to activate.
    00> 
    00> <debug> nrf_dfu_validation: CRC check of app failed. Return 1
    00> 
    00> <debug> app: App is valid
    00> 
    00> <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    00> 
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00> 
    00> <debug> app: Running nrf_bootloader_app_start with address: 0x00001000
    00> 
    00> <debug> app: Disabling interrupts. NVIC->ICER[0]: 0x0
    00> 

Related