2023-05-29 04:17 PM - edited 2023-11-20 04:24 AM
Hi Everyone. My EV Board use 24 MHz HSE but I used PLL to get with 170 MHz, I also set this frequency for the clock of timer module. I could get 2us periodic signal normal from timer setting however I cannot get 1us periodic signal normally (you can check the prescaler and ARR setting in picture). Is there any MCU limitation or what could be the problem? Thanks a lot for help!
***1us signal generation
***2us signal generation
2023-05-30 12:56 AM
Are you trying to toggle a pin in the timer's interrupt? That may not work simply because of interrupt routine's duration.
JW
2023-05-30 01:45 AM
Hi JW. Thank you for your reply. My purpose is to create 1us ISR, currently I do the GPIO toggle for the checking corectness of ISR duration purpose only. As your hyper link, look like the ISR take long time to finish itself, and no way to get the correct 1us for timer ISR, right?
2023-05-30 02:45 AM
That of course depends on what code runs in that ISR.
Cube adds unnecessary layers.
Compiler optimization setting also matters.
JW
2023-05-30 03:06 AM
Interrupts at 1 MHz are generally not viable, and no other work will get done.
Use the TIM HW modes to toggle a pin associated with a TIMx_CHx directly, or use a PWM Output mode with 50/50 duty.
2023-05-30 07:50 PM
Yes. Thank you for your reply. Actually, my target is to create 1us ISR for implement a state machine flow-chart with some if-else loop and also GPIO on and off in-side. The toggle GPIO in the waveforms showed above just the checking signals that I generated to make sure I got 1us or not!
2023-05-30 08:00 PM
Thank you for your reply with some nice keywords!