timing_pal not working as expected

cancel
Showing results for 
Search instead for 
Did you mean: 

timing_pal not working as expected

386 Views
chenk
Contributor II

Originally posted in MPC5xxx timing_pal not working as expected but maybe fits better in this forum.

Hello everyone,

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.

main.c is:

/* Write your code here */
CLOCK_DRV_Init(&clockMan1_InitConfig0);

uint64_t resolution;
uint32_t elapsedTime;
/* Initialize TIMING */
TIMING_Init(&timing_pal1_instance, &timing_pal1_InitConfig);
/* 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 */
TIMING_Deinit(&timing_pal1_instance);

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?

Thanks!

Chen

Labels (1)
Tags (2)
0 Kudos
1 Reply

354 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

see my reply in your original post.

BR, Petr 

0 Kudos