S32K148 FTM_PWM Error

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

S32K148 FTM_PWM Error

1,039 Views
renhaochen
Contributor II

Hi, I'm now developing a motor control integrated project with S32K148 EVB,

After configuring driver with processor expert and initialize, there's problem happened when PWM update duty worked with ADC update or UART update, the FTM_PWM stopped updating after 2~3 times of adc/uart update.

When I check the register value I found something strange:

Before ADC/UART task (everything works fine):

pastedImage_1.png

After ADC/UART task(2~3 times):

pastedImage_2.png

BTW, FTM_PWM works fine if there's no ADC/UART task.

Does anyone has this problem before?

Labels (1)
Tags (2)
0 Kudos
3 Replies

949 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Ren Hao Chen,

Not sure why your ADC/UART reconfigure FTM module.
Please refer: 浅谈嵌入式MCU软件开发之条件断点的设置与使用详解(以S32DS IDE + U-Multink debugger为例介绍)
Set conditional breakpoint in your project and findout which line modify it.
According to your image, I think you can set conditional breakpoint show below:
((FTM4->SC)&FTM_SC_CLKS_MASK) == FTM_SC_CLKS(0)

Managing conditional breakpoints.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

949 Views
renhaochen
Contributor II

Hi Robin,

Thanks for your advises.

After using this break point method, I found out that the register value doesn't change at all.

pastedImage_1.png

But the global variable pointer "ftmStatePtr[0]" provided by Processor Expert has changed, thus the PWM output is continue, just without any value updated.

By tracing the codes, this situation seems happened in " one of " DEV_ASSERT macro, not in a specific line.

pastedImage_2.png

Is there any idea for this?

Thank you!

0 Kudos

949 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Ren Hao Chen,
Sorry for my delay!

Have you try to use Watchpoint with Condition to find out the issue?

for example: (ftmStateStruct).ftmMode==FTM_MODE_NOT_INITIALIZED

Add Watchpoint.png

Watchpoint with Condition.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos