cancel
Showing results for 
Search instead for 
Did you mean: 

TIMER 1 RESOLUTION STM32F103RB

german2
Associate II
Posted on December 10, 2010 at 11:51

TIMER 1 RESOLUTION STM32F103RB

5 REPLIES 5
Posted on May 17, 2011 at 14:18

Depends on your system clock, the granularity can be 72 MHz (13.88 ns), and is then reduced by the PRESCALER, and limited by the 16-bit width of a single timer.

1.5us what's that about 108 ticks? Wouldn't use that as an interrupt source.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
german2
Associate II
Posted on May 17, 2011 at 14:18

Thank you for your quick response, Clive.

But, Why can't use as a interrupt source? I need to sample a digital input port every 1.5us. 

Best Regards,

Andrew Neil
Evangelist III
Posted on May 17, 2011 at 14:18

''Why can't use as a interrupt source?'' 

Nobody said you can't do it!

clive1 was just pointing out that it leaves you very little time indeed between interrups; ie, very little time indeed in which to process one sample before the next one comes along...!
german2
Associate II
Posted on May 17, 2011 at 14:18

Ok!

If i understand correctly the stm32F103RB datasheet, i need to configure the timer 1 with no prescaling, but how i need to configure TIM1->PSC and TIM1->ARR register to obtain 1.5 us interruption time?

Thanks.

Posted on May 17, 2011 at 14:18

You'd set the period to (108 - 1), but unless you are very careful you are going to saturate the processor. Like I said you have 108 cycles @ 72 MHz to play with, which in worse case represents 36 reads from FLASH. You could improve your odds by putting the interrupt and vector code in RAM which is at least single cycle, but you are going to have to think very carefully about how you are going to pull this off. Let's hope you don't need to do divisions.

Consider how you might use peripherals and DMA to perform the work.

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