MQX 4.2 K64F120 :Why the accuracy of hardware timer is too low

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

MQX 4.2 K64F120 :Why the accuracy of hardware timer is too low

571 Views
zzqqq
Contributor I

Hi,

I use the hwtimer in MQX ,But I  find the timer is slow than my phone timer. About  slow 4 seconds every one hour?

Can someone help me ?

Details:

I use external 8M  osc.

#define CPU_BUS_CLK_HZ 60000000U /* Initial value of the bus clock frequency in Hz */
#define CPU_CORE_CLK_HZ 120000000U /* Initial value of the core/system clock frequency in Hz. */

/* HWTIMER definitions for user applications */
#define BSP_1S_PIT_TIMER_DEV pit_devif
#define BSP_1STIMER_SOURCE_CLK (CM_CLOCK_SOURCE_BUS)
#define BSP_1S_PIT_TIMER_ID (0)

The period is 1 second, and I add a counter to count the seconds in the callback function.

Tags (2)
0 Kudos
Reply
1 Reply

485 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi zqq:

Could you let us know your clock mode , FLL or PLL?

How many tasks in your system,  do you have other tasks ?

Actually we have hwtimer demo in MQX installation folder, you can use it for reference.

C:\Freescale\Freescale_MQX_4_2\mqx\examples\hwtimer

Regards

Daniel

0 Kudos
Reply