Unable to modify PWM duty cycle

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

Unable to modify PWM duty cycle

Jump to solution
663 Views
tbiberdorf
Contributor IV

I have a working TWR_K60D freeRTOS project.

I am confused as to why the FTM_UpdatePwmDutycycle() API call does not update the required FTM0-C2V registers unless I single step with the debugger.  When I allow the code to run without stepping, it will not update the registers.

The code can be cloned from the following GitHub repository: GitHub - tsbiberdorf/freeRTOS_TwrK60D: freeRTOS project to run on TWR_K60D hardware with FTM0 PWM op... 

The README file provides the h/w connections to the Tower Expansion board.

When I run the code and place a breakpoint on line 141 and 144 of FTM0Operation.c

at the same time I am monitoring the FTM0 registers.

When I hit the breakpoint on 141 the FTM0 registers provide this:

pastedImage_2.png

when I allow the code to continue to 144 the registers have not been updated:

pastedImage_3.png

Now if I reset the code and allow to run to breakpoint on 141, but single step through the FTM_UpdatePwmDutycycle() API, I find that the registers are updated.

pastedImage_4.png

Why does this not work when running?  why does it only work when single step is happening?  Is there a locking sequence that I'm missing?

Thanks

0 Kudos
1 Solution
603 Views
tbiberdorf
Contributor IV

I added the API call FTM_SetDeadTimeEnable() and now the code is working as expected.  Not sure why, but happy that its working.

View solution in original post

0 Kudos
1 Reply
604 Views
tbiberdorf
Contributor IV

I added the API call FTM_SetDeadTimeEnable() and now the code is working as expected.  Not sure why, but happy that its working.

0 Kudos