Page 1 of 1

backup data realtime

Posted: Sat May 04, 2019 12:19 pm
by tam1111574
Hi Odroid,
I 'm using Odroid Xu4 to my production.
Now I need to find the way to backup data real time suck as counter. Now I save backup data to eMMC each 50 ms after that I run command sync but I think the eMMC can damage in long time.
I need only backup the counter (1 - 20000000). In another my project, I have a RTC IC, I backup counter in some volatile memory in RTC, the RTC can work about 3 year via 3V lion battery.
I see Odroid Xu4 have a lion battery to backup date time, Can I backup counter same as the my method (RTC IC) or another advise for me. ?

Thank and best regards.

Re: backup data realtime

Posted: Tue May 07, 2019 9:36 am
by odroid
The RTC block is a part of the PMIC S2MPS11.
But there is no scratchpad RAM in the RTC block unfortunately.

You need 25 bits NV-register to save the counter value. Right?
If yes, you can do a little bit complicated bit manipulation with the unused Alarm 1 registers in the RTC block probably.
https://github.com/hardkernel/linux/blo ... sung/rtc.h

Re: backup data realtime

Posted: Fri May 10, 2019 1:29 pm
by tam1111574
Yes.. Odroid, I need only some Non voltage Resister to save the counter.

With the Alarm 1 resgister, How can I use it ?. because I'm newbie in Linux kernel.

Re: backup data realtime

Posted: Fri May 10, 2019 1:59 pm
by odroid
If you have no experience of kernel driver development, it will be very painful.

Instead of developing a device driver, try to access the Alarm 0 register via /sys/class/rtc/rtc0/wakealarm from user-land application.
https://wiki.odroid.com/odroid-xu4/appl ... _wakealarm

This sample C code would be helpful for implementing a 25bit counter manipulation via wake.time structure.
https://github.com/karelzak/util-linux/ ... /rtcwake.c

Re: backup data realtime

Posted: Tue May 28, 2019 11:06 pm
by tam1111574
Thank you very much Odroid, I used it to backup data.. I see the value in /sys/class/rtc/rtc0/wakealarm is not lost when I have a CMOS pin.. But Does It have the limit times Read/Write ?..

Re: backup data realtime

Posted: Wed May 29, 2019 10:11 am
by odroid
There would be no limitation virtually.

Re: backup data realtime

Posted: Thu May 30, 2019 12:22 am
by tam1111574
Thank you very much Odroid. You help me save many time :D :D :D :D :D :D :D

Re: backup data realtime

Posted: Thu May 30, 2019 1:48 am
by mad_ady
25 bits worth of time to be precise :D

Re: backup data realtime

Posted: Thu May 30, 2019 9:29 am
by odroid
tam1111574 wrote:
Thu May 30, 2019 12:22 am
Thank you very much Odroid. You help me save many time :D :D :D :D :D :D :D
Glad to hear I could help you.
BTW, can you tell us what you are making with XU4 roughly?
As far as I remember you are the first user who needs a frequent updating counter in a NV-RAM.