MK22FN256(64LQFP) PWM

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

MK22FN256(64LQFP) PWM

1,181 Views
briancavanagh
Contributor III

Hi, I'm using the PWM component and assigned it to PTD5(Pin 62).  I also have a 'heartbeat' led assigned to PTC1(Pin 44) that blinks every 10 seconds. 

When I change the Period for the PWM it also has a direct impact on the heartbeat.

Below you'll see the Period is .5kHz.  If I change to 1kHz, my heartbeat changes also and blinks every 5 seconds.

pastedImage_1.png

TU1:TimerUnit_LDD is assigned to the PWM:

pastedImage_2.png

To determine if TU1 had an affect on any other components I removed it from my project to determine which components were affected by it:

pastedImage_3.png

As you can see above, only PWM1:PWM was affected.

Can someone explain why this would happen.  I'm not sure how to fix this and why the PWM period has an impact on other components that are not using it.

Thanks,

Brian

Note:  I'm using KDS Version 3.2.0

Labels (1)
0 Kudos
Reply
3 Replies

946 Views
mjbcswitzerland
Specialist V

Brian

I think that you need ti explain what is driving the heart-beat LED (is it timer driven? Which timer, Is it SW driven based on a Tick interrupt - which tick?).

PWM from the FlexTimer is driven by the bus clock or the fixed clock MCGFFCLK (unless the clock is from an external pin) and an optional pre-scaler, so as long as some setting is not adjusting your main clock or bus clock divider (or sharing a FlexTimer) I also don't see the relationship at the moment.

Regards

Mark

0 Kudos
Reply

946 Views
briancavanagh
Contributor III

Hi Mark,  TU1 is only used for the PWM.

The code for my heartbeat function is below.  

I did inherit this code from an old co-worker.  If it's timer driven or software driven based on a Tick, I'm not certain.

I've been trying to figure that part out without success.  

pastedImage_1.png

The enable/disabled contents within TU1 is listed below:

pastedImage_2.png

How can I confirm if a "Tick interrupt" is being used?  Note, I have no external clocks coming into the uC.

Thanks Mark,

Brian

0 Kudos
Reply

946 Views
mjbcswitzerland
Specialist V

Brian

Search for the variable Tick and see where it is being "incremented". I suspect it will be in a timer routine (usually Systick interrupt).

Regards

Mark

0 Kudos
Reply