#94988 - pproc - Thu Jul 27, 2006 6:17 am
Hi,
Does anyone have source code examples for accessing the real-time clock on the Procard 128M - this is supposed to be a "lite" version of Xcarts flash card.
Thanks !
#95109 - Sausage Boy - Thu Jul 27, 2006 10:26 pm
I assume the way to access the RTC would be the same in every cart, since they would want it to be compatible with teh romz. How it is actually done, I don't know.
_________________
"no offense, but this is the gayest game ever"
#95152 - dantheman - Fri Jul 28, 2006 1:47 am
It doesn't include sourcecode, but you could try using the RTC utility from the X-ROM tools kit. It's a multiboot program that accesses the X-ROM's RTC, although I have had success using it on my Flash2Advance Ultra cart. It sometimes doesn't work right though. I've found that it never works when I actually send it through multiboot, and it only works with Multiboot Menu when I flash it separately from everything else. I haven't done too much testing, but that is what seems to be the case.
There is also another RTC demo out there that actually has sourcecode with it. Google for "gba rtc" to find it.
EDIT: there also appears to be a few RTC programs with sourcecode at http://www.pat.hi-ho.ne.jp/sata68/gba.shtml although it's all in Japanese.
#95163 - pproc - Fri Jul 28, 2006 3:20 am
I found Timothy Brolins (ampz) rtc source code and am testing with this.
The above links led me to http://www.sii.co.jp and the data sheet for the RTC - it is a Seiko Instruments S3511 or derivative. Datasheet attached. Unfortunately in Japanese, but there are some timing diagrams and indication of the response bytes. Looks like an SPI interface.
Will let you know if I am successful - thanks a lot for the pointers !
#95233 - pproc - Fri Jul 28, 2006 8:54 am
I tested with T. Brolins rtc sample code, modified rtc_detect code to clear and then set the enable bit always.
First I put the rtc functions in iwram space, and then leaving them in rom space. Verified by looking at the linker output map file.
I read the RTC every 5 seconds, printing a 1/60 second frame counter to verify the timing.
End result is that in both cases I am repeatedly reading the following data from the "RTC"
Year 0
Mon 1
Day of Month 1
Day of week 0
Hour 0
Min 0
Sec 0
These are plausible reset values if you look at the data sheet for the RTC chip S3511 for legit values of the above fields (mon and day of month are restricted to 1-12 and 1-31). This is also true for another RTC chip I have used, so am assuming this is generally true.
Perhaps the RTC is never enabled ?
Another puzzling thing is I get the same results when the RTC functions are placed in ROM space....
???