Several problems arising with OTA DFU.

Hi, I am currently using SDK 15.3.0 with SD 6.1.1 and am playing around with the buttonless DFU.

I noticed that after uploading the new firmware via nrf connect, many times the MCU just hardfaults. It happened e.g. after I set NRF_LOG_ENABLE to 0 in the sdk_config.h file for the new firmware (it was still enabled in the old version). this lead to an internal error in a ble advertising function - doesn't make sense at all. I also hardfault or run into an error when I only comment out NRF_LOG_INIT() in a newer version. Why doesn't this just work, which memory addresses does the logging module use that a dfu will certainly end in a broken firmware?

So now I turn of logging in an initial version and want to update the device with a new software, now apparently a timer is not working alright. Something generally seems wrong with the DFU process but I cant debug it and don't know which parameters might be wrong. 

  • Juliusc said:
    I mean it just doesnt work any more and if I attach a debugger I see that it hangs on in that particular state (as shown in the screenshots). 

    I see. The CPU will do something though (either be in sleep waiting for an event, in an eternal loop in an error handler, or something else). It is not just "hanging". So you should debug more to find what is actually the state (and from there backtrack to find out why).

    Juliusc said:
    that should be enough as far as I can see?

    It should be enough yes, but the size is not the issue here. This counts from right below the bootloader. So you need to get a overview of your memory layout and place the flash region you use for persistent storage at a sensible location as explained in my previous post.

  • I understand what youre saying, I cant tell you more than that here: 

    that's one of the halts I get (p_stack_address is 0 at this point)

    there are some other points where the application fails, but that's now the last failure I got after doing a DFU

    Do you have another pointer on what I shall look for? 

    So you need to get a overview of your memory layout and place the flash region you use for persistent storage at a sensible location as explained in my previous post.

    Understood, I will do that!

  • I see, here it is in a hardfault handler. There are several approaches you could use, but I would start by using the hardfault handler library. With that and logging you will get a printout that can be very helpful. Most example projects have the files as part of the project already, so you typically only need to set HARDFAULT_HANDLER_ENABLED to 1 in sdk_config.h.

  • yeah but thats where I am right now, in the hardfault handler and it faults at this nrf_log_final_flush function

    my hardfault handler is enabled tho

  • Hey Einar, so I changed the flash start and end addresses to 0xec000 to 0xeffff after finding out that the dfu always worked if I didn't use the storage module. 

    This now seems to work, I did some tests and until now it didn't fail. My question is now if you think that this is tangible or just a fluke and if I should take a close look to something in my storage usage? 

Related