STM32 U545 Timer Interrupt

5 次查看(过去 30 天)
Malitha
Malitha 2024-12-16
评论: Vikky Patil 2024-12-27
Hello,
I'm using a STM32 U545RE-Q with the embedded coder support package for STM32 Microprocessors on MATLBA/Simulink R2024b to generate a timer interrupt that will blink the onboard LED once a second. I've used Timer 16 for this but I can't seem to get the LED to blink.
Any help of how to get this working would be appreciated.
Thanks.
Kind Regards,
Malitha.

回答(2 个)

Vikky Patil
Vikky Patil 2024-12-24
Providing an update event through input to a Timer block allows you to generate an update event via software. Consequently, there's no need to manually input the update event to the Timer block. If the sample time of the update event is very short, the LED may toggle at a rate too high for the human eye to observe. Additionally, you can remove the counter enable port if you don't need to enable or disable the timer at runtime.
Also try to downlaod the latest updates for 24b if available
  1 个评论
Malitha
Malitha 2024-12-24
Hi Vikky,
Thank you so much for reaching out. In the case of the update event, do I still have to tick the update interrupt in the timer configuration? and also can you elaborate on the sample time please?

请先登录,再进行评论。


Vikky Patil
Vikky Patil 2024-12-25
In the scenario mentioned above, enabling the "Enable Update Interrupt" will trigger the execution of the code within the Function Call Subsystem linked to a hardware interrupt during an Update Event, causing the LED to toggle
If "Enable Update Interrupt" is not selected in the case mentioned above, the Update interrupt will not be generated, and consequently, the LED will not toggle since the update interrupt is disabled.
When the sample time of the constant block connected to the timer block's UG (Update Generation event) input is very small, it will generate the software update event at the specified rate, causing the LED to toggle at that rate. For instance, if the sample time is set to 1ms, the Update event will occur every 1ms, and the LED will toggle at the same interval, which is too fast for the human eye to perceive.
Therefore, it is recommended to let the timer generate the update interrupt internally when the counter reaches its period, rather than providing input to the timer block via the UG port to programmatically generate a software interrupt.
  2 个评论
Malitha
Malitha 2024-12-27
Hi, I changed and tried to run the code again but the LED is just staying on instead of blinking once in every. Is there something that I could be missing?
Vikky Patil
Vikky Patil 2024-12-27
Could you replace the GPIO pin currently connected to the LED with another GPIO pin on a different port, which can be connected to a Digital Storage Oscilloscope (DSO) to check if the pin is toggling? If so, can you determine the on and off periods at which the GPIO pin is toggling?
Kindly contact Technical Support and share the following:
  • Any downscaled model where issue is reproducible
  • Corresponding .ioc file
  • The GPIO pin on and off period observed on the DSO in above case

请先登录,再进行评论。

产品


版本

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by