So i init the wakeup like this
Code: Select all
void clkInit( void )
{
rtcGetTime( &RTCD1, &ts );
rtcGetDtStructTm( &ts, &t );
clk.sec = t.tm_sec;
clk.min = t.tm_min;
clk.hrs = t.tm_hour;
clk.day = t.tm_mday;
clk.mon = t.tm_mon + 1;
clk.year = ( t.tm_year - 100 );
/* set wakeup */
wakeupspec.wutr = (( uint32_t )4) << 16; /* select 1 Hz clock source */
wakeupspec.wutr |= ( 1 ); /* Period in seconds */
rtcSTM32SetPeriodicWakeup( &RTCD1,
&wakeupspec );
}
then setup the exti to capture the interrupt.
Code: Select all
static const EXTConfig extio = {
{
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_RISING_EDGE | EXT_CH_MODE_AUTOSTART, extcb2} // RTC_WAKEUP EVENT
}
};
void extioInit( void )
{
/*
* Activates the EXT driver.
*/
extStart( &EXTD1, &extio );
}
static RTCWakeup wakeupspec;
static void extcb2(EXTDriver *extp, expchannel_t channel)
{
(void)extp;
(void)channel;
palTogglePad(GPIOE, GPIOE_GRN_LED);
/* re-setup wakeup */
// wakeupspec.wutr = (( uint32_t )4) << 16; /* select 1 Hz clock source */
// wakeupspec.wutr |= ( 1 ); /* Period in seconds */
// rtcSTM32SetPeriodicWakeup( &RTCD1,
// &wakeupspec );
}
Does one need to reset any interrupt ? as all that is happening is the callback is firing very fast, and not at 1Hz as expected ?