Using Processor Real Time Clock With MQX

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

Using Processor Real Time Clock With MQX

1,218 Views
Tim562
Senior Contributor I

Hi All,

     I'm using MQX 3.8.1.1 on an MPC-5125 processor with the Real Time Clock (RTC) battery circuit in place and operational. Currently, every time the board is restarted the current time is reset to 01/01/1970 (MQX default start time). Is there an MQX #define statement that I can adjust in the user_config.h file to prevent MQX from resetting the time at each reset? Perhaps there's another way to prevent MQX from resetting the time at startup? Couldn't find any guidance on this in the MQXUG document (Rev 4, 12/2011) and I'm hoping to avoid modifying MQX source code to accomplish this since every time I do that I need to document the changes and restore them in the event of an MQX update. Thanks for any suggestions!

Best,

Tim

Tags (3)
0 Kudos
2 Replies

347 Views
Luis_Garabo
NXP TechSupport
NXP TechSupport

Hi Tim,

Actually, MQX will not retain any real time clock value since it is only source code. What you actually need to do is to synchronize with the RTC from the MCU once it is configured correctly.

You'll see, there is a RTC driver already in MQX that helps you to configure it and set the time you want. You need to do this only once or every time you think the RTC is out of time. If you then have the RTC battery then the internal hardware module will keep counting and keeping the time count. So, what you need to do next is to on every MQX restart go and check the RTC time to then synchronize the MQX time with the one in the RTC. You can find a very good example of ow to do both task in this example:

C:\Freescale\Freescale MQX 3.8\mqx\examples\rtc

You can find more information about the RTC driver in this document:

C:\Freescale\Freescale MQX 3.8\doc\mqx\MQXIOUG.pdf

Hope this helps you!


Regards,
Garabo

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

347 Views
Tim562
Senior Contributor I

Thank you Garabo, I see the example project you mentioned, that should be just what's needed to make this work. Have a great day.

Best,

Tim

0 Kudos