Hi,
Many thanks to Rod & bubulindo for the work. I've only just got my Maple clone (Olimexino) and after 2 days have a working RTC running along with a SD card with timestamps. Very pleased.
I've used the MapleRTC that (I think) bubulindo produced/linked to and it works a treat. There is one problem though, and I'm not sure if this was deliberate/debug code or there is a good reason for it, but in the file RTClock.cpp in the RTC constructor code it resets the counter to 0 each time it's initialised. This doesn't quite make sense to me for a RTC as it means the RTC doesn't survive resets or re-programming. I've taken both lines out with no ill effect.
rtc_set_count(0);//initializing... just in case
I'm running the LSE clock which, on the Olimexino at least, is pretty robust as it keeps working even if a reset or program change occurs. It even seems to work in sleep modes and running at very low clock rate (AHB 140khz? div512). It even survived a power down for a second or so. That makes it easy to use as you set the time once, then reprogram with something else. I made a quick test prog that waits for 5 seconds for something from serialusb, then either interprets it as the time or just continues with the RTC as it's setup. Had it running on battery for 12hrs at 140khz or so, no problem, though a time loss of 10 seconds or so. Easily fixed with a fudge or maybe calibration? I just do this to set the time on it date "+%s" >/dev/cu.usbmodem3d121
Incidentally, for anyone else reading this with an Olimexino, I've been going through the MapleSD library and tidying it up so it works fully and is easy to setup on either Maple or Oli. There were a few minor changes to the code, nothing too drastic, just a few fixes for listing and writing files and a bit of timestamp code that only needs to be #included to work with the MapleRTC. I've also written a (very) quick hack to allow all the Arduino examples to compile on the Maple without having to change any code. Would anyone be interested in this as an update?
Will this RTC code by incorporated into libmaple or will it be left as a library?