AnsweredAssumed Answered

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

Question asked by zqq zqq on Oct 31, 2016
Latest reply on Nov 3, 2016 by Daniel Chen

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.

Outcomes