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

Bootloader hangs in "while (nrf_clock_lf_is_running())" loop.

Hi,

I have a problem, like this fellow engineer  here, but the solution is not applying for me.

Our firmware support different modes of operations. Mode changes are done through a Soft Reset. Bootloader starts before main application, and when it tries to do the nrf_drv_clock_uninit(), it will stuck and hang in stopping the LFCLK.(more accurately it will stuck and watchdog will kick in and reset the system.).

This problem only visible when I'm doing mode changes, and Soft Reset. It dose not exist running up from PIN Reset or Power On.

More specifically here:

    nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTOP);
    while (nrf_clock_lf_is_running())
    {}

I'm sure, I am doing something wrong in main application. any idea where the problem may be hiding??

(nrf52-Dev kit, SDK v14.2, )

I'm suspecting that WatchDog would cause the problem, as turning on the watchdog my cause the LFCLK to be on all the time. (just a possible scenario, I am not sure about it)

If you have any idea, would be glad to hear. Thanks guys.

Parents
  • And, one more thing i just notice. if I comment out the nrf_drv_clock_uninit(), Everything would operate smoothly,

    but another problem would pop up. At the end of OTA update, when everything is finished and bootloader is about to jump to main application, I will get watchdog rest. I don't know where would it now be stuck, as I can see it will go as following logs:

    <debug> app: Enter nrf_dfu_app_is_valid
    <debug> app: Return true. App was valid
    <debug> app: Enter nrf_dfu_app_is_valid
    €€€€rÐpˆl@@ @0@ @©pÕpÐ¨s¨s¨s¨s¨s¨s¨sªs¨s¨s¬sð( ¥J“J 	
    @j¼qåA

    I actually get the garbage characters in the end of log. After this, the watchdog reset the system. after reset bootloader would run properly and my main application run as intended.

    ( and yes I feed the watchdog all the way during the OTA and bootloader)

  • I would be happy if Nordic engineers officially confirm my observation, and suggest a way if there is a reliable solution here.

    Your observation is correct. WDT forces the LFCK to be on. As mentioned in this post here, the bootloader implementation in SDK 14 does not support WDT, and requires modifications to support the WDT.

    Watchdog support in the bootloader was first added in SDK 15. You might want to take a look at that (see the file called nrf_bootloader_wdt.c/h in SDK 15.0).

    With regards to the garbage log, you could try to set NRF_LOG_DEFERRED to 0 in sdk_config.h, and see if that helps.

Reply Children
No Data
Related