Timer 3, Interrupt frequency>1MHz
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2012-01-11 2:54 PM
Posted on January 11, 2012 at 23:54
How to get interrupt frequency bigger than 1MHz ?
I have Discovery F4 Board and use Timer 3 as TIM_TimeBase Example. I have code as follow: __IO uint16_t CCR1_Val = 10000; __IO uint16_t CCR2_Val = 1000; __IO uint16_t CCR3_Val = 100; __IO uint16_t CCR4_Val = 10; PrescalerValue = (uint16_t) ((SystemCoreClock / 2) / 84000000) - 1; TIM_TimeBaseStructure.TIM_Period = 65535; TIM_TimeBaseStructure.TIM_Prescaler = 0; TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); TIM_PrescalerConfig(TIM3, PrescalerValue, TIM_PSCReloadMode_Immediate) Chanels and stm32f4xx_it.c are configured as TIM_TimeBase Example. (Measured toggling frequency)=(Interrupt frequency)/2TIM3CC=84MHz
CCRx_VAL
Measured toggilng f. [Hz] Theoretic Interrupt f. [Hz]1 10000 4200 8400
2 1000 42000 84000
3 100
640.6 bad
8400004 10
406.8 bad
8400000 Why there are bad values? Next example:
TIM3CC=1MHz
CCRx_VAL Measured toggilng f. [Hz]
Theoretic Interrupt f. [Hz]1 65530 7,62 15,260
2 64000 7,81 15,625
3 10 50000 100000
4 5
15,25 bad
200000 I need 10MHz interrupt frequency in my project, how can I get this? #stm32-timer3
Labels:
- Labels:
-
TIM
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2012-01-11 3:48 PM
Posted on January 12, 2012 at 00:48
I need 10MHz interrupt frequency in my project, how can I get this?
You must be pretty new at this. Those kind of frequencies require hardware. For a processor running at 120 MHz, you'd have 12 cycles to play with at 10 MHz. The Cortex-M3 takes 12-cycles to stack an interrupt, I doubt the M4 is any better. So when do you expect to do anything? With insufficient cycles the processor will saturate and miss interrupts. Access to a peripheral device is the order of 4-cycles. At 1 MHz you'll have 120 cycles, that's a pretty tight budget to do anything practical. The timers can generate very high rates, these are designed for output pins, acting autonomously, not to be serviced by interrupts.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
