S32K144,FTM

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

S32K144,FTM

739 Views
LzdOo
Contributor III

Use FTM to output PWM, and call the SDK library function FTM_DRV_UpdatePwmPeriod() to adjust the PWM period. May I ask if several channels within the same FTM can be set to different periods? Can the output period of PWM be greater than 20ms within a 20ms polling task?

Tags (2)
0 Kudos
Reply
9 Replies

725 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@LzdOo

1.Channels under the same FTM instance can be set with different duty cycles, but cannot be set with different frequencies.

2. I don't see any relations between 20ms task and 20ms duty cycle.

 

0 Kudos
Reply

716 Views
LzdOo
Contributor III

Hi Senlent

I attempted to set a 20Hz (50ms) PWM output within a 20ms task, but the actual output was 50Hz (20ms); however, it was successfully set within a 50ms task. Could you please explain what the reason is?

Tags (1)
0 Kudos
Reply

696 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@LzdOo

Could you please share your test project, so that i can help you to find the reason why.

0 Kudos
Reply

668 Views
LzdOo
Contributor III

Hi, Senlent

This is my Demo project.

LzdOo_0-1750810592160.png

LzdOo_1-1750810669819.pngLzdOo_2-1750810687862.png

LzdOo_3-1750810749416.pngLzdOo_4-1750810777702.png

 

 

 

0 Kudos
Reply

638 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@LzdOo

I can't open the project you provided, it should be encrypted.
I made a simple test demo

Senlent_0-1750846399464.png

 

0 Kudos
Reply

620 Views
LzdOo
Contributor III

Hi, Senlent

Your routine performs the delay within the "while" loop. However, the question I initially raised was:

In the task scheduling of FreeRTOS, a 20ms task can execute a PWM output with a cycle of 20ms, but cannot execute a PWM output with a cycle of 50ms.

Furthermore, my entire project has at least four periodic tasks, such as 1ms, 5ms, 10ms, and 20ms, and each task performs a different function.

Returning to the original question, can a 50ms PWM output be executed within a 20ms task? Is it understood that the MOD register is re-assigned every 20ms, and when I set the MOD value to 50ms within the 20ms task, it is not possible to achieve a 50ms PWM output in time and is interrupted by the next 20ms task? The effect is that although a 50ms setting was made, it still outputs at a 20ms frequency?

0 Kudos
Reply

606 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@LzdOo

Please provide your new project so I can test and modify it. I cannot open your previous project.

0 Kudos
Reply

655 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@LzdOo

Provide the complete project, no screenshots.

0 Kudos
Reply

652 Views
LzdOo
Contributor III

Hi, Senlent

This is the complete project.

0 Kudos
Reply