On January 27th, this site will be read-only as we migrate to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,632 Users
  • 2,269,769 Discussions
  • 7,916,800 Comments

Discussions

FRDM-K64F set the realtime clock from code?

2892292
2892292 Member Posts: 7
edited Mar 3, 2015 6:34PM in Java ME Embedded

Hi, all!

I have read the docs about rtc.time in the jwc_properties.ini file. This works ok when installing, but when the device resets or power is cycled, the clock will be incorrect. Since my app is communicating with a server, it would be simple to get the current datetime from the server. But I have not found any way to set the current clock other than the jwc_properties.ini file. Is there a way I can do this in my app? Or can my app write to the jwc_properties.ini file and then restart itself?

Thanks!

Answers

  • Sergey.N-Oracle
    Sergey.N-Oracle Member Posts: 99
    edited Mar 3, 2015 5:39AM

    Hi!

    It is impossible to access RTC registers from Java app.

    /Sergey

    2892292
  • Andrey.P-Oracle
    Andrey.P-Oracle Member Posts: 157
    edited Mar 3, 2015 6:41AM

    Hi!

    Actually you can change the value of the property using the following method:

    Settings.setStringProperty("rtc.time", "2016:01:01:00:00:00");

    Your application shall exit after invoking this line in order for the property to be written into the file. Please note that the rtc is only updated from the property during power-up or reset of the MCU. So that the new time is not applied when your application restarts, you need to force MCU to restart. And because Java APIs are limited on k64 there seem to be no way to initiate that from the application

    Regards,

    Andrey

    2892292
  • 2892292
    2892292 Member Posts: 7
    edited Mar 3, 2015 6:34PM

    Thanks for the info. It sure would be nice...

    Maybe I need to set a pin to force a reset! 

This discussion has been closed.