FTM_PWM_Config minimal example

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

FTM_PWM_Config minimal example

1,203 Views
clag
Contributor I

I am trying to set up a minimal example that makes use of Model-Based Design Toolbox to generate PWM. If I build the model below and flash it I only have noice on the PTA2 pin. Whereas if I manually Programm it up it works (so the hardware seems to be fine.)

Tags (2)
0 Kudos
4 Replies

1,023 Views
mariuslucianand
NXP Employee
NXP Employee

Hello clag@ethz.ch‌,

Your model does not generates the signals on the pins because the timer is not started. There are some application, like Motor Control that requires to initialize the PWM at a certain moment in the application. In order to enable the timer, go to the PWM block, check the "Show advanced options" and then check the "Start PWM signals generation immediately after initialization". Should have been checked by default, but now we know the problem :smileygrin:.

pastedImage_3.png

If you need to start the timer at a certain moment inside the code, you need to add the following block, select the module and the Action Enable.

pastedImage_5.png

Hope this helps, 

Marius

0 Kudos

1,023 Views
mariuslucianand
NXP Employee
NXP Employee

Hello clag@ethz.ch‌,

We are talking about the same mot file? So if you manually program the generated mot file, it runs? Are you sure that the generated code reaches the board automatically? Because from your screenshot, the Download Code after Build is not checked, so the model will generated only the mot file and will not flash the mot on the controller. 

pastedImage_1.png

Consider checking the the Download Code after Build, select OpenSDA if you are trying to run this code on the EVB or you have an OpenSDA and then select the correct Drive Name. 

If my understanding is wrong, consider attaching your model to have a closer look on your settings. 

Hope this helps you, 

Marius

0 Kudos

1,023 Views
clag
Contributor I

Thanks for the answer.

I am using Matlab to build the model and the S32 Design Studio for ARM to download it to the EVB.

I tried what you suggested and did use the "Download Code after Build" functionality. But the issue is not yet solved.

I had a Programm running that was generating a PWM on said pin and then build the model. Afterwich the pwm was off, what makes me believe, that the code reached the board but is faulty in a way or another.

I also double checked with a diffrent model. That one reached the board just fine (with both procedures, as you described and using s32 Design Studio)

0 Kudos

1,023 Views
clag
Contributor I

Thanks for the awesome and quick answer! :smileyhappy:

To clarify I build the model in Matlab and then used S32 Design Studio for ARM Version 2018.R1 to upload it. I just used a project I had was working on and then in the "Debug Configurations..." >"C/C++ Application:" put the link to the generated .elf file.

I will try the approach you mentioned and keep you posted.

0 Kudos