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
KnarfB
Principal III

If the period is too long for a single timer, you can cascade two timers in a master/slave fashion. Alternatives are more frequent interrupts and a software counter in the interrupt handler or using the RTC.

hth

KnarfB

+1

RTC Alarm

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

Clock your used timer with slow clock and use prescalers, example clk 8MHz prescaler 65534 use 16bit counter to time 100s

but i dont cleanly understand your question. You need delay or repeated interrupt or wake from low power...

Thanks KnarfB and clive1 for your update.

Can please give some sample code or hint like how can I calculate or configuration?

Bhautik
Associate II

Thanks MM for your update.

Actually I want to generate timer interrupt. Ex : Require timer interrupt means after 5 min generate interrupt and device enter in to the sleep mode [low power mode].

How can I configure counter parameter setting for timer interrupt?

Can you please give some example how can I configure?

STM32Cube_FW_L0_V1.11.2\Projects\NUCLEO-L031K6\Examples\RTC\RTC_Alarm

'

RTC usually count in seconds,

Read the RTC chapter, it has TWO alarms. pick your time(s) into the future

https://www.st.com/resource/en/reference_manual/dm00108282-ultralowpower-stm32l0x1-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

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 input.

Is it possible using TIM1/TIM2 [general purpose timer]?

(65536 * 65536) / 32,000,000 = 134.217728 seconds, maximal

Depends on what speed you're clocking at, you could interrupt at seconds, and count those elapsing

100 seconds, 100 * 32,000,000 / 64000 = 50000

Prescaler = 64000-1

Period = 50000 - 1

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

Thanks clive,

I have configure TIM1 timer.

Please find attached timer configure image. Is configuration right?? can you please confirm.