How to use GPT timer Channels on RT1024

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to use GPT timer Channels on RT1024

776 次查看
Patrick_K
Contributor I

Hello,

currently I am trying to evaluate the i.MX RT1024 for use in a future product.

I'm trying to create a simple application with two timer driven subsystems, where one subsystem is executed at 1ms and the other subsystem is executed at 10ms.

I chose to use channel 1 and 2 of GPT2 for this purpose. However, when I run the project, both of the subsystems run at the same 10ms rate.
How can I run two tasks from the same timer but from different channels using the MBDT?

The attached solution is the closest I could manage. The attached model is entirely self-contained - no need for the simulink project (if you are asked to open the project file as well)

标记 (2)
0 项奖励
回复
1 回复

658 次查看
georgevictor
NXP Employee
NXP Employee

Hi, @Patrick_K,

Thank you for using MBDT for i.MX on your projects.

I have downloaded the attached example and tried to run it on my side considering your specific requirements of using the GPT2 instance with two channels configured but I didn't encounter any issues.

I have replaced the two subsystems provided with an LED toggle, but I have kept the logic for the interrupts generated by the GPT2 peripheral. The attached example demonstrates how the board LED is controlled by two interrupts from channel 1 and channel 2. The interrupt from channel 2 occurs every 2 seconds and turns on the LED, while the interrupt from channel 1 occurs every 2.5 seconds and turns off the LED right after it has been on for 0.5 seconds.

In the picture below is the actual configuration, where I highlighted the Output Compare interrupt enablement for both Channel 1 and Channel 2, along with the Compare value (period) that is set to 2 seconds for the second channel and to 2.5 seconds for the first one.

georgevictor_0-1697122824351.png

Please let me know if this model works as expected on your side and if it helps you find the issue with your project.

 

Cheers,

Victor

 

0 项奖励
回复