gpio sampling rate

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

gpio sampling rate

Jump to solution
886 Views
Sriram
Contributor IV

Hello i am trying to interface a noctua pwm fan with the s32k144evb . the fan provides rpm feedback as pwm output. i made a rpm counter model to measure the frequency of the pwm output provided by the fan to get the rpm value. The gpio pins are not able to sample the signal at frequency above 50hz. i tried generating a square pulse and gave it as a input to gpio pin and measured the signal using a oscilloscope by giving the gpio output to another gpio block. gpio tracks the pulse till 50hz after that it just shows a straight line at 5v

i want to know what is the sampling rate of the gpio pins and the adc in s32k166 and s32k144

Thank you

Tags (3)
0 Kudos
Reply
1 Solution
860 Views
SorinIBancila
NXP Employee
NXP Employee

Hello,

If you want to get better results, I suggest you to check the example "ftm_input_capture_s32k14x" included in the toolbox. It uses the FTM peripheral to get the timestamp of the channel input event. The timestamp is computed based on the System Clock (80 MHz).

Example: If the timestamp is 2000 (with the Prescale Factor of 2) it means that the frequency of the PWM signal is  System_Clock / (Timestamp * Prescale_Factor) = 80 MHz / (2000 * 2) = 80000 kHz / 4000 = 20 kHz.

Let me know if this solution works for you.

Yours faithfully,

Bancila Sorin

PS: Whenever you need to have fast execution time, the Freemaster can add a lot of overhead. In order to solve this problem, you can go to Freemaster and select the Sampling period of the variable you want to monitor to Once. In the model, you need to add the Freemaster_Poll_Call block to update the variable. You can add this block in a Triggered Subsystem and then use timers (e.g PIT) to execute at a slower pace (e.g. 1 sec).

 

View solution in original post

0 Kudos
Reply
1 Reply
861 Views
SorinIBancila
NXP Employee
NXP Employee

Hello,

If you want to get better results, I suggest you to check the example "ftm_input_capture_s32k14x" included in the toolbox. It uses the FTM peripheral to get the timestamp of the channel input event. The timestamp is computed based on the System Clock (80 MHz).

Example: If the timestamp is 2000 (with the Prescale Factor of 2) it means that the frequency of the PWM signal is  System_Clock / (Timestamp * Prescale_Factor) = 80 MHz / (2000 * 2) = 80000 kHz / 4000 = 20 kHz.

Let me know if this solution works for you.

Yours faithfully,

Bancila Sorin

PS: Whenever you need to have fast execution time, the Freemaster can add a lot of overhead. In order to solve this problem, you can go to Freemaster and select the Sampling period of the variable you want to monitor to Once. In the model, you need to add the Freemaster_Poll_Call block to update the variable. You can add this block in a Triggered Subsystem and then use timers (e.g PIT) to execute at a slower pace (e.g. 1 sec).

 

0 Kudos
Reply