2020-10-07 02:40 AM
Hello
I have used Nucleo-L031K6 dev kit.
How can I generate timer interrupt for 100 sec/500 sec delay?
2020-10-07 10:06 PM
Probably, I'm not a CubeMX/IDE guy, but looks like it might suffice.
STM32Cube_FW_L0_V1.11.2\Projects\NUCLEO-L031K6\Examples\TIM\TIM_TimeBase
2020-10-07 10:29 PM
Thanks clive1 for your valuable support
2020-10-08 05:49 AM
Hmm your idea Ex : Require timer interrupt means after 5 min generate interrupt and device enter in to the sleep mode
is little hard understand. In real code is sequence reversed users set interrupt to future and enter immediately low power mode. On interupt is mcu wake and continue in code. For your example you dont need interrupt, you need counter variable inc or dec in systick interrupt, and when variable counting is valid time do your sleep or other thinks... I use systick every 1ms (can be set any period) then if your counter variable is set to 300000 and decremented in systick
when zero arive you can sleep...
example in stm32f0xx_it.c or were you have IRQ func write
void SysTick_Handler(void)
{
TimingDelay_Decrement();
}
and in main.c
static __IO uint32_t TimingDelay,TimingDelay1,TimingDelay2;
void TimingDelay_Decrement(void)
{
if (TimingDelay != 0x00) TimingDelay--;
if (TimingDelay1 != 0x00) TimingDelay1--;
if (TimingDelay2 != 0x00) TimingDelay2--;
}
then you can use this as milisecond countdown in your code...
TimingDelay=300000;
while ...
...
/* Configure and enable the systick timer to generate an interrupt each 1 ms */
SysTick_Config((SystemCoreClock / 1000));