bootloader doesnt start application

there is some weird behavior on my XIAO nrf52840. Im developing omn skd 15.3 am using a secure bootloader.

all of my dfu OTA processes work well but I noticed that some of my chips wont start the application from the bootloader. to be precise I can debug the bootloader up to this pont: 

ASSERT((dst_addr % CODE_PAGE_SIZE) == 0);

in the nrf_bootloader_fw_activation.c file (line 81)

after this line the bootloader goes back to its start. this doesnt happen on every chip though so I dont know whats happening at all.

The flash readings of a chip that works and one that doesnt are identical for my firmware.
Parents Reply Children
  • Hi Julius,

    Are you intentionally generating with bl-setting version 1? Why?

    Did you change to recommended version and see if it makes difference.

    I can see is that "Even though bootloaders compiled from an nRF5 SDK 15.3.0 or later can only use version 2, they can be configured to support a version 1 settings page. When a new bootloader with a version 1 settings page boots, the bootloader translates the settings page to version 2 before booting."

    Also, if you want to change the files, then you can remove the assert statement, or do the conditional compilation (if condition then do assert, or the other way around). You can also see if you could / should disable the assertion (as in this ticket). 

    BR, Naeem

  • no i didnt do it intentionally, I overread the recommendation.

  • Hey Naeem if you could help me once more please, Ive not really focused on this problem as it didnt always happen but do you think the bl-settings might be the reason why this would happen?

    imma lad you through my debugging process once more so that maybe you can tell if this is it or not (I am using bl-settings currently and didnt run into the problem again but this doesnt seem to be 'proof' that its the solution.

    so if I debug a 'broken' sensor, it will go go like this:

    //jump into this:
    nrf_bootloader_fw_activate();
    
    //then here it will give a 1 (VALID APP) although it should be 0, so thats where the problem actually starts
    switch (p_bank->bank_code)
    
    //then go into this.
    ret_val = app_activate();
    //and this is where the assert happens:
    ret_val = image_copy(target_addr, src_addr, length_left, NRF_BL_FW_COPY_PROGRESS_STORE_STEP);
       
        

    so what I gather from this is that the p_bank->bank_code is actually wrong and I cannot do anything about it bc this bankcode comes from the bootloader settings page (as far as I can see)

    so if this is the case, and if I used the wrong bl_settings (version 1) this might have an effect on the bootloader reading out the s_dfu_settings struct right? and thats where it goes wrong, I couldnt think of anything else triggering this process. 

    what do you think?

    I also thought about using a costum assert but honestly it doesnt seem like a great idea bc so many things could break that I cant see and also the problem appears to happen earlier so it doesnt really make sense to fight this 'symptom'

  • Hello Julius,

    Thank you for your patience.

    I think you are debugging your issue in the right direction. 

    I would also suspect that the using different bl-setting page generated by using wrong version number is the culprit here. 

    Looking at the underlying code, (python DFU script under the nrfutil), I see that depending upon the version number used, the nrfutil uses a different struct. I also see that bank0_bank_code can be 0x0 or 0x1 depending upon the "app_file". I am not very expert in this, but definitely it looks like something went wrong when you generated bl-settings.

    BR, Naeem

  • I also found the "defective" part in the raw hex from the sensors is exactly at the address that should hold the bankcodes.

    So my strategy now is to go with this approach, make another 50 samples and test them for a week, lets see if the error comes up again, as the rate was around 10-15% id expect it to happen if this wasnt the right fix. Ill get back to you no matter the outcome next week. Thanks for your help though

Related