Hi NXP experts,
I'm using a S32G-EVB board equipped with S32G274.
I'd like to use the PPS interrupt to implement a hardware timer.
Here is my scenario:
Let me take PPS0 as an example. I'd like to generate a 100ms timer.
1. I configured the start time of the first pulse in "MAC_PPS0_Target_Time_Seconds" and "MAC_PPS0_Target_Time_Nanoseconds" according to the current PTP time(sec=5; nsec=13947460). The start time of the first pulse is (sec=7; nsec=0).
2. When the time reached, an interrupt was generated with MAC_Timestamp_Status=0x2 (TSTARGT0:Timestamp Target Time Reached for PPS0). Till now, everything was fine. In the ISR, I updated "MAC_PPS0_Target_Time_Seconds" and "MAC_PPS0_Target_Time_Nanoseconds" with (sec=7; nsec=100000000).
3. Then I got another interrupt with MAC_Timestamp_Status=0x8(TSTRGTERR0: Timestamp Target Time Error for PPS0). I checked the PTP time of the interrupt: sec=7; nsec=39637340 which was far from sec=7; nsec=100000000
In GMACSUBSYSRM, the description of TSTRGTERR0 is as below:
This bit is set when the latest target time programmed in the MAC_PPS0_Target_Time_Seconds and
MAC_PPS0_Target_Time_Nanoseconds registers elapses.
From above, we can see that the time configured in the Target Time registers did NOT elapse.
Following chapter 1.16.10.5 Programming Guidelines for Flexible Pulse-Per-Second Output of GMACSUBSYSRM, I tried setting TRGTMODSEL0 of MAC_PPS_Control to
00b - Target Time registers are programmed only for generating the interrupt event.
10b - Target Time registers are programmed for generating the interrupt event and starting or
stopping the PPS0 output signal generation
When TRGTMODSEL0 == 10b, I also tried setting PPSCTRL_PPSCMD of MAC_PPS_Control to
0000: No Command
0001: START Single Pulse
0010: START Pulse Train
But I always got the same result as I showed above: MAC_Timestamp_Status=0x8 in the second interrupt.
Could you please let me know whether I did anything wrong?
What should I do to achieve my aim: the scenario described above?
Thanks!
Hi,
Are you programming the Width(MAC_PPS0_Width) and interval(MAC_PPS0_Interval) registers correctly? Also, please follow the steps "1.16.10.5.2 Generating Next Pulse on PPS repeatedly" for generating the pulse in a repeated time manner.
Thanks,
Mayank s Patel