Unable to modify PWM duty cycle

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

Unable to modify PWM duty cycle

跳至解决方案
1,179 次查看
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 项奖励
回复
1 解答
1,119 次查看
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 项奖励
回复
1 回复
1,120 次查看
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 项奖励
回复