MQX 3.7 On MPC5125 Tower System Time Of Day Very Inaccurate

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MQX 3.7 On MPC5125 Tower System Time Of Day Very Inaccurate

ソリューションへジャンプ
1,913件の閲覧回数
Tim562
Senior Contributor I

Hi All,

 

    I'm developing an app on a TWR-MPC5125 processor board and have found that the MQX system time loses about 1 second per minute of run time (Running under Ext Ram Debug from CodeWarrior). I have my app update the time using SNTP_oneshot() from time.nist.gov every 15 minutes and note how much time correction is required to get my MQX system time to agree with the SNTP server. My MQX system time is almost exactly 15 seconds slow at each update (5 seconds slow if I update every 5 minutes, etc). My application will need accurate time of day information to perform automation tasks at user programmed times (one second resolution is required).

 

     I'm wondering if this can be corrected (and if it's normal to have to correct it) by calling the MQX time_set_ticks_per_sec() function? Maybe the MQX time_set_resolution() function? In addition to the basic time functions I am using a 100mS timer interrupt in TIMER_ELAPSED_TIME_MODE to take care of various housekeeping tasks (maybe timers interfere with time of day?). I'm going to experiment some but if anyone has been through this before and could offer some advice that would be great. Thanks in advance. ~Tim

0 件の賞賛
返信
1 解決策
1,658件の閲覧回数
dwillett
Contributor I

Check your crystal frequency.  The schematics and MQX code call for 33.3M but some boards have a 32.768M crystal.  Update your linker files (.lcf) to use the correct frequency:

 

__EXTERNAL_CLOCK_SPEED = 32768000;

 

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,659件の閲覧回数
dwillett
Contributor I

Check your crystal frequency.  The schematics and MQX code call for 33.3M but some boards have a 32.768M crystal.  Update your linker files (.lcf) to use the correct frequency:

 

__EXTERNAL_CLOCK_SPEED = 32768000;

 

0 件の賞賛
返信
1,658件の閲覧回数
Tim562
Senior Contributor I

Your idea about why MQX time was slow was exactly correct. TWR-MPC5125 module has a 32.768 MHz crystal installed and the MQX linker control file specified 33.333MHz for the clock frequency. Corrected the LCF and the system now keeps perfect time! Thank you again for taking the time to respond. Happy holidays.

 

~Tim

0 件の賞賛
返信
1,658件の閲覧回数
Tim562
Senior Contributor I

That's a real good thought, thank you I will check that out.

 

Regards,

Tim

0 件の賞賛
返信