BeeKit and PWM on TWR-MKW24

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BeeKit and PWM on TWR-MKW24

Jump to solution
1,246 Views
cbiscut
Contributor I

Hello,

 

I'm a little new to the BeeKit environment and have successfully followed a few of the design guides to create and modify the solutions to start/connect and interact with other nodes on a network. I was hoping to have one end point control a motor but whenever I attempt to initiate FTM0 for generating a PWM signal it messes up the kernel and Leds 2 and 4 become permanently lit. I am using PORTD_PCR4 on alt 4 (FTM0_CH4) for the PWM signal. I do know that an LED(I believe LED4) is also on PORTD_PCR4 and adjusted all commands involving LED4 to use LED3 instead. I'm not worried about this affecting the output of LED3. I have tried a few other FTM configs and all mess up the kernel. To me it seems that the TS_Kernel must be using the flex timers for their own use. When I debug, FTM0 is enabled by default as is the system clock for PORTD. I attached my PWM code. Any help on getting this PWM to work correctly with the kernel would be much appreciated. If it can't be done with the kernel that information would also be helpful.

Original Attachment has been moved to: PWM.c.zip

Labels (2)
Tags (2)
0 Kudos
1 Solution
952 Views
mihaidragnea
NXP Employee
NXP Employee

Hello Caden,

FTM0 is used by the Timer module (..\PLM\Source\TMR\) on channel 0.

The task scheduler (TS) kernel is not using the FTM0 module but it receives events from the timer module (which uses FTM).

If you reconfigure the FTM0 module then the Timer module will be affected and the thus the entire system.

Another observation is that PORTD is not clocked by the FTM but the peripheral clock (which comes from the MCG module).

My recommendation is to use a different FTM module (FTM1 or FTM2).

Or you may try to reconfigure the Timer module to use the FTM1 instead of FTM0 (..\PLM\Interface\TMR_Interface.h)

Hope this helps.

Regards,

Mihai.

View solution in original post

2 Replies
953 Views
mihaidragnea
NXP Employee
NXP Employee

Hello Caden,

FTM0 is used by the Timer module (..\PLM\Source\TMR\) on channel 0.

The task scheduler (TS) kernel is not using the FTM0 module but it receives events from the timer module (which uses FTM).

If you reconfigure the FTM0 module then the Timer module will be affected and the thus the entire system.

Another observation is that PORTD is not clocked by the FTM but the peripheral clock (which comes from the MCG module).

My recommendation is to use a different FTM module (FTM1 or FTM2).

Or you may try to reconfigure the Timer module to use the FTM1 instead of FTM0 (..\PLM\Interface\TMR_Interface.h)

Hope this helps.

Regards,

Mihai.

952 Views
cbiscut
Contributor I

Thank you Mihai. According to the reference manual(MK2xDxxx pg.84-87) it looks like only FTM0 has any outputs to external pins. So if I'm not mistaken my only option is to reconfigure the TMR_Interface which I will get started on. Thanks again!

0 Kudos