Originally posted in MPC5xxx timing_pal not working as expected but maybe fits better in this forum.
Working with the DEVKIT-MPC5748G, I am trying to use the timing_pal module to set a call to a function every fixed time interval. However, the timer doesn't seem to be starting.
timing_pal configuration are pretty much all default except for my callback function (which is of course not called). The module is configured to use the PIT clock.
As troubleshooting, I copy-pasted in the example script that comes with the SDK user manual. Timer init function returns OK status. After starting the timer (cyclic), elapsed time always comes back 0.
/* Write your code here */
/* Initialize TIMING */
/* Get tick resolution in nanosecond */
TIMING_GetResolution(&timing_pal1_instance, TIMER_RESOLUTION_TYPE_NANOSECOND, &resolution);
/* Start channel counting with period is 1 second */
TIMING_StartChannel(&timing_pal1_instance, TIMER_CHANNEL, (TIMER_PERIOD_NANO / resolution));
/* Get elapsed time in ticks */
elapsedTime = TIMING_GetElapsed(&timing_pal1_instance, TIMER_CHANNEL);
/* Get elapsed time in nanosecond */
elapsedTime = elapsedTime * resolution;
printf("ElapsedTime: %d\n", elapsedTime);
/* De-initialize TIMING */
Tried different period settings, from a few dozen ticks to the 1-sec equivalent from the sample code. Am I missing something? Am I doing something wrong?