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

RTC2 continues to operate in Application after Bootloader execution

Hello, Guys!

As I know, the Bootloader uses RTC2.

The problem is that RTC2 continues to operate after executing the bootloader, in my Application.

My Application not uses RTC2, and there is no any handler for RTC2_IRQn. When RTC2_IRQn happens the program freezes at Dummy_Handler.

After reset by Watchdog the RTC2 registers are cleared and the program runs well.

I solved my problem by executing this code at startup of my Application.

    uint32_t mask = NRF_RTC_INT_TICK_MASK     |
                    NRF_RTC_INT_OVERFLOW_MASK |
                    NRF_RTC_INT_COMPARE0_MASK |
                    NRF_RTC_INT_COMPARE1_MASK |
                    NRF_RTC_INT_COMPARE2_MASK |
                    NRF_RTC_INT_COMPARE3_MASK;

    NRFX_IRQ_DISABLE(RTC2_IRQn);

    nrf_rtc_task_trigger(NRF_RTC2, NRF_RTC_TASK_STOP);
    nrf_rtc_event_disable(NRF_RTC2, mask);
    nrf_rtc_int_disable(NRF_RTC2, mask);

I think my solution is not very good. Counting RTC2 in my Application is the consequence of executing bootloader.

Are you familiar with this problem? What would be a good solution?

I use SDK 16.0.0

Parents
  • Hi Denis, 

    When do you see that RTC kept running after the bootloader ? Was it on a normal booting or it's right after a DFU update ? 
    As far as I know in SDK v16 (and newer) the bootloader will trigger a reboot after it receives the image. This reboot will reset all the peripherals that the bootloader uses including the RTC2. 
    On a normal booting RTC2 shouldn't be running as the bootloader would go straight to the application. 

  • The RTC2 keep running:

    • After OTA DFU
    • After downloading and running firmware via j-link
    • After click Restart in debugger in SES
    • After selfreset by NVIC_SystemReset()

    The RTC2 is in reset state:

    • After reset by PINRESET
    • After reset by Watchdog
    • If there are no Bootloader in internal flash

    I did make some changes in Bootlodaer. May be this is a reason:

    1. I enabled WDT by adding nrf_bootloader_wdt_init() to the first line in main

    I attached sdk_config.h file of Bootloader

    3583.sdk_config.h

Reply
  • The RTC2 keep running:

    • After OTA DFU
    • After downloading and running firmware via j-link
    • After click Restart in debugger in SES
    • After selfreset by NVIC_SystemReset()

    The RTC2 is in reset state:

    • After reset by PINRESET
    • After reset by Watchdog
    • If there are no Bootloader in internal flash

    I did make some changes in Bootlodaer. May be this is a reason:

    1. I enabled WDT by adding nrf_bootloader_wdt_init() to the first line in main

    I attached sdk_config.h file of Bootloader

    3583.sdk_config.h

Children
Related