imx rt snvs periodic interrupt

cancel
Showing results for 
Search instead for 
Did you mean: 

imx rt snvs periodic interrupt

68 Views
bp1979
Contributor IV

Hi,

Trying to use the RTC clock of the imx rt (1024). The basics work, but I need an interrupt every time the RTC increments seconds.

    void rtc::initialize()
    {
        SNVS_HP_RTC_GetDefaultConfig(&_snvs_rtc_config);
        _snvs_rtc_config.periodicInterruptFreq = 1;
        
        SNVS_HP_RTC_Init(SNVS, &_snvs_rtc_config);

        _rtc_date_time.year   = 2014U;
        _rtc_date_time.month  = 12U;
        _rtc_date_time.day    = 25U;
        _rtc_date_time.hour   = 19U;
        _rtc_date_time.minute = 0;
        _rtc_date_time.second = 0;

        SNVS_HP_RTC_SetDatetime(SNVS, &_rtc_date_time);
        SNVS_HP_RTC_StartTimer(SNVS);

        SNVS_HP_RTC_EnableInterrupts(SNVS, kSNVS_RTC_PeriodicInterrupt);
        EnableIRQ(SNVS_HP_WRAPPER_IRQn);

        NVIC_SetPriority(SNVS_HP_WRAPPER_IRQn, 3);
    }

 

This is pretty much a 1 on 1 copy from the example, but then in cpp.

Below is the interrupt handler, which keeps being triggered. The interrupt is firing non-stop. Why?

        void SNVS_HP_WRAPPER_IRQHandler(void)
        {
            if (SNVS_HP_RTC_GetStatusFlags(SNVS) & kSNVS_RTC_PeriodicInterruptFlag)
            {
                // This fires non-stop, regardless of next clear. Why??
                SNVS_HP_RTC_ClearStatusFlags(SNVS, kSNVS_RTC_PeriodicInterruptFlag);
            }

        }   

 

I also read this from the reference manual, but I have no clue what I can do with that information.

bp1979_0-1667479351900.png

 

Can you please tell me how I can achieve to receive 1 interrupt, every second, when the RTC incremented its time with one second?

 

0 Kudos
1 Reply

63 Views
bp1979
Contributor IV

 

        SNVS_HP_RTC_GetDefaultConfig(&_snvs_rtc_config);
        _snvs_rtc_config.periodicInterruptFreq = 15;

 

 

Seems to get close to what I am looking for. Is there a way to get an interrupt from RTC *right after* RTC incremented one second? So that I can reset my msec timer and keep them in sync?

0 Kudos