STM32L431RB Timer15 1 microsec interrupt generation. Is there anything incorrect with my timer15 peripheral configuration?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-10 6:32 AM
The APBCLK/AHBCLK is 80MHz.
when I toggle the GPIO in the callback, the scope trace gives me interrupt generation of 2.3 usec instead of 1usec. Is there any timing limitation for interrupt generation?
- Labels:
-
STM32L4 series
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-10 7:09 AM
Your CPU is overloaded. A 1MHz interrupt at 80 MHz clock gives 80 cycles per interrupt, which, if you're using HAL, is certainly not enough. Even without HAL it can be marginal depending on what you're doing.
There's no limitation to interrupt generation. But you can only run code so fast.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-10 7:13 AM
Thanks for the reply.
So, In order to generate 1 us interrupt what parameter settings you would recommend? Or if it's not correct to generate 1 us interrupt hwta would be your recommendation period with less than 100us?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-10 7:19 AM
Your code is generating interrupts every 1us. But your cpu isn't keeping up with them. Looks like ~430kHz is the max you can do with your current code.
Lower the rate of generation so your CPU can keep up. Generally, 10kHz interrupt rate is fine. 100kHz might be fine with small code. All depends on what you're doing in the IRQ, of course.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-10 7:28 PM
Use hw assist to relax the timings, or use FPGA. 1us interrupt is like 1000 heart beats per minutes stress.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-11 12:44 AM
If this is just for testing, as the pin name suggests, use the raw interrupt handler (generated in *_it.c file) with highest compiler optimization (no stack frame) instead of the HAL wrapper. The fastest way to waggle a pin is configuring it as EVENTOUT and issue a __SEV() instruction, not using GPIO at all.
hth
KnarfB
