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

About serial bootloader for NRF52840

Hello All,

We are using NRF52840 module, need to work on serial bootloader.

I have gone through the bootloader example, our requirement is need the serial(UART) bootloader without any security(signature validation) code base.

I understood that open bootloader is only for USB, so I started looking in to the example available in "nRF5_SDK_17.0.2_d674dde\examples\dfu\secure_bootloader".

1. For NRF52840, secure_bootloader_uart_mbr_pca10056. Is this can I use for my development or do I have any other project which suites my requirement? Serial bootloader without any security feature. Bare metal bootloader to update application image.

2. In this one another question I have if I modify the structure "nrf_dfu_bank_t" by adding one variable to this. Any issue to the MBR. This particular structure is used in nrf_dfu_settings_t for bank_0bank_1. 

I request to reply ASAP.

Thanks & Regards,
shekar

  • Hi Shekar,

    1. For NRF52840, secure_bootloader_uart_mbr_pca10056. Is this can I use for my development or do I have any other project which suites my requirement? Serial bootloader without any security feature. Bare metal bootloader to update application image.

    The SDK does not provide any bootloader without support for signature verification. However, you can refer to my colleague Einar's answer to achieve that.  

     

    2. In this one another question I have if I modify the structure "nrf_dfu_bank_t" by adding one variable to this. Any issue to the MBR. This particular structure is used in nrf_dfu_settings_t for bank_0bank_1. 

    The structure nrf_dfu_bank_t is used as the description of a single bank. I don't think it will cause the issue. Please let me know if you see something wrong. 

    -Amanda H. 

  • Thanks Amanda H.

    I have another question about the example code nRF5_SDK_17.0.2_d674dde\examples\dfu\secure_bootloader".

    In this secure_bootloader_uart_mbr_pca10056 project, i downloaded to nrf52840 chip as i understand the workflow. It will go to the DFU mode if no valid app exist in the chip, when it is in DFU mode it will wait for 120 seconds(as default) no communication on serial it will reboot the bootloader.

    But my observation is it will keep coming back to main() function once it go to "loop_forever()" then it is coming out.

    It should wait in that loop_forever() API correct? why this miss behavior please do let me know.

    Thanks,

    shekar

  • Hi, 

    Shekar said:
    In this secure_bootloader_uart_mbr_pca10056 project, i downloaded to nrf52840 chip as i understand the workflow. It will go to the DFU mode if no valid app exist in the chip, when it is in DFU mode it will wait for 120 seconds(as default) no communication on serial it will reboot the bootloader.

    I think you mean the inactivity_timeout function which function will reboot when it gets timeout (#define NRF_BL_DFU_INACTIVITY_TIMEOUT_MS 120000) before automatically starting a valid application due to inactivity.

    When the bootloader enters the main loop, it will be in the loop_forever() to wait for an event (or action). If there is no event and timeout while in the loop_forever(), it will back to main().

    -Amanda H.

  • Hi Amanda,

    You mean "If there is no event and timeout while in the loop_forever(), it will back to main()."

    1. While waiting for an event in loop_forever() API it is in while(true) condition. How it will back to main?

    2. How can I enable debug logs, I can see "NRF_LOG_DEBUG" , "NRF_LOG_INFO", "NRF_LOG_WARNING", "NRF_LOG_ERROR". I just need to see the flow and add few more debug messages in code. Not sure which one to use. Where can I see those messages?

    Thanks,

    shekar

  • Hi Shekar,

    Shekar said:
    1. While waiting for an event in loop_forever() API it is in while(true) condition. How it will back to main?

    Sorry, my previous answer is not complete and that might cause the misunderstand. 

    loop_forever() relays on the inactivity timer and will get inactivity_timeout as you thought at first. If you add NRF_LOG_FINAL_FLUSH(); after NRF_LOG_DEBUG("Resetting bootloader.");  and set the breakpoint at nrf_dfu_settings_backup(do_reset); in the bootloader_reset(). It will trigger it and gets the log while it has timeout without action. Without the breakpoint, you might not see the log of "Resetting bootloader." The reason might be the device is probably rebooting too fast so that the debugger is not able to read the message in time.

       

     

    Shekar said:
    2. How can I enable debug logs, I can see "NRF_LOG_DEBUG" , "NRF_LOG_INFO", "NRF_LOG_WARNING", "NRF_LOG_ERROR". I just need to see the flow and add few more debug messages in code. Not sure which one to use. Where can I see those messages?

     You could modify RF_LOG_DEFAULT_LEVEL in the sdk_config.h to adjust the log info. 

    // <o> NRF_LOG_DEFAULT_LEVEL - Default Severity level

    // <0=> Off
    // <1=> Error
    // <2=> Warning
    // <3=> Info
    // <4=> Debug

    #ifndef NRF_LOG_DEFAULT_LEVEL
    #define NRF_LOG_DEFAULT_LEVEL 4
    #endif

    -Amanda H.

Related