AN5303 flex timer S32 example

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

AN5303 flex timer S32 example

1,452 Views
johnbanks
Contributor II

Trying to get the dual edge capture example working from this application note:

https://www.nxp.com/docs/en/application-note/AN5303.pdf?fsrch=1&sr=1&pageNum=1 and the associated zip file on the same page.

Using S32K144EVB, S32DS 2018.R1, I used file...open projects from file system. After fixing the --version problem with: Error while launching command: --version 

and changing #define SW to 5, the example launches on the board.

I see a 10KHz frequency on PTB2 and PTB3 with 0.89V and 2.5V on DVM suggesting ~18% and 50% duty cycle as expected.

Interconnect: PTB2 and PTD15 externally, PTB3 and PTD0 externally as per the code and the blue and red LEDs illuminate. The voltages change because of the drop across the LEDs as expected, but the frequencies remain at 10KHz as expected.

I installed the PE micro feature to show realtime expressions whilst the program is running, and when the program is paused by the debugger I can see values in the expression tab of the debugger. FTM0_CH0_pulse_width and FTM0_CH2_pulse_width do not update from 0. To make sure the debugger is displaying values I added an int counter variable and did counter++ in the empty for loop and can see this incrementing in realtime expressions whilst the program is running and in the expression tab when the program is paused.

I do not know if it is a problem with the example, or a problem bringing the example into a much later S32DS.

2 Replies

1,093 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi John,

Which version of S32K144 do you use?

It seems it was written for the old 0N77P version which has different vector table.

The interrupts should be reconfigured.

I would recommend creating a new project with updated header files and modify the code.

Regards,

Daniel

1,093 Views
johnbanks
Contributor II

Adding a counter to the interrupt routine for single or dual edge capture reveals it is not being called, whereas a counter in the main for loop is being incremented.

The FTM example in the cookbook also has glitches where the 62500 MOD value for the PWM source is reset to 0, and the capture interval is then an unsigned subtraction of 0-56250 giving a result of 9286 instead of 6250 ever 10 samples.

0 Kudos