cancel
Showing results for 
Search instead for 
Did you mean: 

Timer base event without interrupt

Broman3100
Associate III

Hello everyone,

I got a time1 on STM32F103C8 running at 72Mhz with settings:

0693W00000Y6jcrQAB.pngIf I used an interrupt, I would get callback every 30 seconds, however I want to do basically same using polling method, is there a register or a HAL function I can use to check for an update flag and clear it myself?

1 ACCEPTED SOLUTION

Accepted Solutions
KiptonM
Lead

There is an interrupt flag that turns to 1 when an interrupt should occur. There is also an enable interrupt that makes the interrupt happen when the interrupt flag goes to 1.

You need to keep the interrupt enable 0 (not activated) and watch (poll) the interrupt flag. When the interrupt flag goes high it will stay high until you switch it to 0. Your polling routine should do this. When it sees it go high, do your task, and reset it back to zero until it goes to 1 again.

View solution in original post

2 REPLIES 2
KiptonM
Lead

There is an interrupt flag that turns to 1 when an interrupt should occur. There is also an enable interrupt that makes the interrupt happen when the interrupt flag goes to 1.

You need to keep the interrupt enable 0 (not activated) and watch (poll) the interrupt flag. When the interrupt flag goes high it will stay high until you switch it to 0. Your polling routine should do this. When it sees it go high, do your task, and reset it back to zero until it goes to 1 again.

S.Ma
Principal

Usually a status flag is created to report an event. Sey by hw and cleared by sw. From this bit, it goes through an interrupt enable bit to provide in the end your callback, if you need it. Polling is a quick start. When core workload and power saving comes into play, polling looks gross. So you know what is waiting for you down the road....