2010-12-10 02:51 AM
TIMER 1 RESOLUTION STM32F103RB
2011-05-17 05:18 AM
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.2011-05-17 05:18 AM
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,
2011-05-17 05:18 AM
''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...!2011-05-17 05:18 AM
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.
2011-05-17 05:18 AM
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.