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

Best way to see logs for custom bootloader while OTA DFU

Hi,

I'm doing some changes to the bootloader to be able to copy the old app in bank 0 to another extra bank (bank 2) in case of needing to do a rollback without connection to the central device.

However, if I try to see the logs of the OTA process using the J-Link RTT Client, I will only be able to see the logs after the update because there is a reset when a new app is programmed.

Is there a better workflow I can use to see the logs while the update is happening? Before the update, I stop getting logs when the device goes from the app to DFU mode.

I'm using the secure bootloader `pca10056_s140_ble_debug`.

Thanks in advance.

  • Hi,

    The reset in it self is should not be a problem, but it may be that the app overwrites the bootloader's RTT buffer in RAM before the debugger has had a chance to locate it (https://wiki.segger.com/RTT). What I usually do when I want to capture debug logs during DFU is that I first start a debug session with the bootloader project and let the execution reach main() before I let the program execution continue to the main app. Have you tried that as well?

    RTT buffer sections

  • Hi Vidar,

    Thanks for the suggestions. Right now, I can see the logs. I found that the easiest way to achieve it was to program the board only with the bootloader and SoftDevice. Then, the device will enter DFU mode directly and the logs show just fine. However, I am not 100% sure that all logs are shown. For example, in this snippet, one line was partially overwritten by another and I believe some logs may be missing.

    <debug> nrf_dfu_req_handler: All flash operations have complet<debug> app: No copy needed

    Is there any way to make sure all logs are printed? I usually write while (NRF_LOG_PROCESS() != false) {}; if I want to make sure that the previous NRF_LOG_DEBUG(); will be printed. I use JLinkExe -device NRF52840_XXAA -if SWD -speed 1000 -autoconnect 1 and JLinkRTTClient to see the logs.

    Would turning off certain optimization flags for the bootloader help in this situation?

  • Hi,

    Messages will be dropped if the log buffer is full, so you can try to increase the NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE and SEGGER_RTT_CONFIG_BUFFER_SIZE_UP size in your bootloader's sdk_config.h file.  Increasing the SWD interface speed from 1000 to 4000 may also help.

  • It seems that doubling NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE to 128 and changing the speed to 4000 did the trick. Thanks again.

Related