cancel
Showing results for 
Search instead for 
Did you mean: 

How can I generate timer interrupt for 300 sec STM32L0 series?

Bhautik
Associate II

Hello

I have used Nucleo-L031K6 dev kit.

How can I generate timer interrupt for 100 sec/500 sec delay?

12 REPLIES 12

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks clive1 for your valuable support

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));