#16246 - dagamer34 - Wed Feb 11, 2004 4:29 am
I wanted to know how to access the Real Time Clock functions on the GBA. It's not in any of the GBA docs I've read.
I can't understand the VBA source because its quite complicated to me. And the PCEAdvance code is also quite complicated. Any help here? There really isn't anything to look at and learn from in previous topics.
_________________
Little kids and Playstation 2's don't mix. :(
#16267 - torne - Wed Feb 11, 2004 1:16 pm
The GBA itself has no realtime clock. Several commercial games have an RTC in the cart (pokemon..etc), thus, some flashcarts have added an RTC. The RTC in a flashcart is not neccecarily accessed the same way as in the commercial game (as the flash linker can just patch the game as it writes it); other than disassembling a game that uses an RTC (after patching it) or reading the VBA source, I'm not sure how you'd find out.
#16274 - FluBBa - Wed Feb 11, 2004 2:04 pm
dagamer34 wrote: |
I can't understand the VBA source because its quite complicated to me. |
Well, reading from and writing to the RTC is quite complicated, I might make a clock program in C soon.
On the other hand it shouldnt be so hard to find out what chip is used is Pokemon and then find the documents for that chip.
The EZ-whatever flash cart uses a different RTC then the one in Pokemon and patches the game "on the fly" the new X-ROM and F2A Ultra should be at least directly compatible with the RTC in Pokemon.
_________________
I probably suck, my not is a programmer.
#16309 - dagamer34 - Thu Feb 12, 2004 3:58 am
Flubba, how soon is soon? Like tomorrow?
That would be real useful to us all. That way we won't have 4 topics over the same thing that lead to nowhere.
_________________
Little kids and Playstation 2's don't mix. :(
#16331 - ampz - Thu Feb 12, 2004 7:37 pm
dagamer34: How about like now?
I threw together a RTC Demo.
Enjoy!
Last edited by ampz on Tue Mar 16, 2004 10:36 pm; edited 1 time in total
#16344 - dagamer34 - Fri Feb 13, 2004 12:58 am
I just happen to own an EZFA... crap. Can I say crap on this board? Will anybody hunt me down?
How did you find out this info? Would the manufacturer of the EZFA actually give me the information needed to use the RTC?
One last question, how would you set the date?
Thanks a lot.
_________________
Little kids and Playstation 2's don't mix. :(
#16345 - ampz - Fri Feb 13, 2004 1:16 am
It is a multiboot image. Not sure if VBA can multiboot?
You can recompile it to a 'normal' image if you want.
The reson for it beeing a multiboot image is so that you can run it on a Pokemon cart if you have one.
Currently noone I know of knows how to access the EZ RTC. Dunno if they would give out the info on request, but I doubt it..
There is not support in my software for changing the date and time... Yet. Will probably add that at a later time ;)
#16349 - dagamer34 - Fri Feb 13, 2004 2:23 am
Later time being tomorrow?
Again, I ask, how did you figure this stuff out? Its not exactly in a document or a tutorial.
_________________
Little kids and Playstation 2's don't mix. :(
#16350 - ampz - Fri Feb 13, 2004 2:45 am
dagamer34 wrote: |
Later time being tomorrow? |
When I have the time to spare and feel like it :)
dagamer34 wrote: |
Again, I ask, how did you figure this stuff out? Its not exactly in a document or a tutorial. |
A combination of different sources of information. Mostly RE.
#16351 - dagamer34 - Fri Feb 13, 2004 2:49 am
Do you like pulling my strings and yanking my chain??
How about you do it for me???
And what is RE?
_________________
Little kids and Playstation 2's don't mix. :(
#16357 - tepples - Fri Feb 13, 2004 3:52 am
"RE" == reverse engineering
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#16362 - ampz - Fri Feb 13, 2004 11:06 am
dagamer34 wrote: |
Do you like pulling my strings and yanking my chain?? How about you do it for me??? |
I didn't think someone really needed the ability to set the date/time right now. Especially not people with a incompatible EFA cart ;-)
#16367 - Cyberman - Fri Feb 13, 2004 6:17 pm
ampz wrote: |
dagamer34 wrote: | Do you like pulling my strings and yanking my chain?? How about you do it for me??? |
I didn't think someone really needed the ability to set the date/time right now. Especially not people with a incompatible EFA cart ;-) |
Indeed Stone knives and bear skins.. stone knives and bear skins ;)
I suppose there is nothing wrong with asking, however I wonder why he is so interested in playing with the RTC (hmmm).
Cyb
_________________
If at first you don't succeed parachuting is NOT for you.
#16376 - dagamer34 - Sat Feb 14, 2004 1:26 am
I am trying to make a library that is "complete". RTC is missing, along with saving to EEPROM and Flash ROM.
Just curious. Besides, i can't make a game right now since my trial version of PSP8 ran out and I won't get my copy for about 2 weeks.
_________________
Little kids and Playstation 2's don't mix. :(
#16377 - tepples - Sat Feb 14, 2004 1:51 am
dagamer34 wrote: |
Besides, i can't make a game right now since my trial version of PSP8 ran out and I won't get my copy for about 2 weeks. |
What does PSP do that GIMP 2.0 doesn't?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#16378 - ampz - Sat Feb 14, 2004 2:17 am
dagamer34 wrote: |
I am trying to make a library that is "complete". RTC is missing, along with saving to EEPROM and Flash ROM.
|
Ah! I see.
To do things by the book, I should actually make a standard time.h implementation. I did look at it, but it felt kind of stupid because it would require me to first convert the already properly formated and BCD coded date and time to a single integer representing the time since 1979 in seconds. And, after that, the number has to be converted back to BCD coded date and time. That's why I did not do a time.h implementation :)
Does anyone know what kind of API N use for the RTC?
Last edited by ampz on Sat Feb 14, 2004 2:23 am; edited 1 time in total
#16381 - dagamer34 - Sat Feb 14, 2004 2:23 am
Words from the manufacturer of the EZFA: "use Nintendo RTC library~ and then let EZFA patch it."
So, I went looking through Pokemon Ruby and I found this string: "SIIRTC_V001". I suppose it has something to do with N's RTC library, but I think there is more. Any info on this?
_________________
Little kids and Playstation 2's don't mix. :(
#16616 - ampz - Sat Feb 21, 2004 2:13 am
dagamer34 wrote: |
Words from the manufacturer of the EZFA: "use Nintendo RTC library~ and then let EZFA patch it."
So, I went looking through Pokemon Ruby and I found this string: "SIIRTC_V001". I suppose it has something to do with N's RTC library, but I think there is more. Any info on this? |
"use Nintendo RTC library~ and then let EZFA patch it."
*LOL* EZFA sure are funny... Nintendo's libraries are not exactly publicly available.
It is close to impossible to copy the library from a Pokemon cart. You must have access to the original library. See the problem here? :)
The string you found is simply the version number of the library.
#24047 - dagamer34 - Tue Jul 27, 2004 12:22 am
Sorry for bringing this topic back from the dead, but if I were able to get the "loader" off of the EZFA cart, could someone take a look at it and find out what addresses it writes to in order to access the RTC?
_________________
Little kids and Playstation 2's don't mix. :(
#24052 - torne - Tue Jul 27, 2004 1:08 am
Yeah, I'll have a look. My profile is filled with exciting ways to contact me.
#24075 - FluBBa - Tue Jul 27, 2004 2:24 pm
Doesn't the clock in Pogoshell work on EZFA carts?
The funny thing is that there are now 3 different clocks somewhat compatible with each other.
My implementation in my emulators works on VBA and Pokemon cart/XRom/F2AU.
Pogoshell works on VBA and EZFA (i think it is).
Maybe it's possible to implement a routine that works on VBA, EZFA & Pokemon cart.
_________________
I probably suck, my not is a programmer.
#24092 - dagamer34 - Tue Jul 27, 2004 8:31 pm
torne wrote: |
Yeah, I'll have a look. My profile is filled with exciting ways to contact me. |
Isn't that right! Anyway, it just hit me on the head that you can dump the EZFA cart with a different linker in order to get to the "loader" ROM. I heard someone did this with an EZF II PS. As soon as I get the ROM from this person, I'll give it to you.
_________________
Little kids and Playstation 2's don't mix. :(
#24261 - ampz - Sat Jul 31, 2004 12:41 am
FluBBa wrote: |
Doesn't the clock in Pogoshell work on EZFA carts?
The funny thing is that there are now 3 different clocks somewhat compatible with each other.
My implementation in my emulators works on VBA and Pokemon cart/XRom/F2AU.
Pogoshell works on VBA and EZFA (i think it is).
Maybe it's possible to implement a routine that works on VBA, EZFA & Pokemon cart. |
X-ROM and F2AU use exactly the same RTC as the Pokemon games. EZFA does not. As far as I know, the EZFA is not even remotely similar.
I don't see where you get the third RTC?
#24270 - phonymike - Sat Jul 31, 2004 6:24 am
I have a boktai cart, and would like to try this code on it. maybe tomorrow :)
#24279 - wintermute - Sat Jul 31, 2004 11:08 am
tepples wrote: |
dagamer34 wrote: | Besides, i can't make a game right now since my trial version of PSP8 ran out and I won't get my copy for about 2 weeks. |
What does PSP do that GIMP 2.0 doesn't? |
update the screen today :P
#24283 - tepples - Sat Jul 31, 2004 4:00 pm
wintermute: Did you refer to the fact that the link to GIMP 2.0 unstable is now a 404? That's because the link to GIMP 2.0 stable now works.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#24293 - wintermute - Sat Jul 31, 2004 10:54 pm
tepples wrote: |
wintermute: Did you refer to the fact that the link to GIMP 2.0 unstable is now a 404? That's because the link to GIMP 2.0 stable now works. |
no, I meant if your PC isn't exactly up to date then you can have a coffee while it redraws things.
#24299 - dagamer34 - Sun Aug 01, 2004 2:38 am
wintermute wrote: |
tepples wrote: | wintermute: Did you refer to the fact that the link to GIMP 2.0 unstable is now a 404? That's because the link to GIMP 2.0 stable now works. |
no, I meant if your PC isn't exactly up to date then you can have a coffee while it redraws things. |
Probably breakfast too.
_________________
Little kids and Playstation 2's don't mix. :(
#24417 - FluBBa - Tue Aug 03, 2004 11:01 am
ampz wrote: |
X-ROM and F2AU use exactly the same RTC as the Pokemon games. EZFA does not. As far as I know, the EZFA is not even remotely similar.
I don't see where you get the third RTC? |
VBAs implementation, apparently Pogoshells clock works in VBA, as does my code.
Pogoshells clock doesn't work on X-Rom but works on EZFA.
My code works on X-Rom but not on EZFA.
_________________
I probably suck, my not is a programmer.
#24429 - dagamer34 - Tue Aug 03, 2004 4:48 pm
FluBBa wrote: |
ampz wrote: | X-ROM and F2AU use exactly the same RTC as the Pokemon games. EZFA does not. As far as I know, the EZFA is not even remotely similar.
I don't see where you get the third RTC? |
VBAs implementation, apparently Pogoshells clock works in VBA, as does my code.
Pogoshells clock doesn't work on X-Rom but works on EZFA.
My code works on X-Rom but not on EZFA. |
Are you sure Pogoshell's clock works on EZFA? Let me go check...
_________________
Little kids and Playstation 2's don't mix. :(
#24450 - ampz - Tue Aug 03, 2004 9:24 pm
FluBBa wrote: |
ampz wrote: | X-ROM and F2AU use exactly the same RTC as the Pokemon games. EZFA does not. As far as I know, the EZFA is not even remotely similar.
I don't see where you get the third RTC? |
VBAs implementation, apparently Pogoshells clock works in VBA, as does my code.
Pogoshells clock doesn't work on X-Rom but works on EZFA.
My code works on X-Rom but not on EZFA. |
If what you say is true then VBA must emulate both the standard RTC and the EZFA RTC, and pogoshell only supports the EZFA RTC.
#24459 - dagamer34 - Wed Aug 04, 2004 12:42 am
FluBBa wrote: |
ampz wrote: | X-ROM and F2AU use exactly the same RTC as the Pokemon games. EZFA does not. As far as I know, the EZFA is not even remotely similar.
I don't see where you get the third RTC? |
VBAs implementation, apparently Pogoshells clock works in VBA, as does my code.
Pogoshells clock doesn't work on X-Rom but works on EZFA.
My code works on X-Rom but not on EZFA. |
What version of PogoShell were you using?
_________________
Little kids and Playstation 2's don't mix. :(
#24470 - FluBBa - Wed Aug 04, 2004 8:59 am
Hmmm, was I dreaming? Or did I use Sasq's SDL version of VBA?
Sorry for any confusion, I have to check this out.
brb.
_________________
I probably suck, my not is a programmer.
#25211 - dagamer34 - Wed Aug 18, 2004 9:12 pm
torne wrote: |
Yeah, I'll have a look. My profile is filled with exciting ways to contact me. |
I finally got the loader off of the cart. Check your e-mail. I sent it to you earlier.
_________________
Little kids and Playstation 2's don't mix. :(
#25224 - MonkeyBoy666 - Thu Aug 19, 2004 1:14 am
dagamer34 wrote: |
my trial version of PSP8 ran out and I won't get my copy for about 2 weeks. |
ok i don't know if this works with 8 but it does with 7 and 6 of psp. Why don't you try to set your system clock back to a time when the trial was working. I know this is technally wrong but if you can't wait two weeks for your new one to come then...(it is only for 2 weeks)
#25229 - dagamer34 - Thu Aug 19, 2004 2:32 am
MonkeyBoy666 wrote: |
dagamer34 wrote: | my trial version of PSP8 ran out and I won't get my copy for about 2 weeks. |
ok i don't know if this works with 8 but it does with 7 and 6 of psp. Why don't you try to set your system clock back to a time when the trial was working. I know this is technally wrong but if you can't wait two weeks for your new one to come then...(it is only for 2 weeks) |
...
It might help to look at the time of which I posted that, you know. Because sometimes old threads can be revived, like I did. I already have a legal copy of PSP8. Thanks for trying to help though. :)
_________________
Little kids and Playstation 2's don't mix. :(
#26655 - ampz - Wed Sep 22, 2004 1:46 am
FluBBa wrote: |
Pogoshells clock doesn't work on X-Rom but works on EZFA. |
The pogoshell clock works on X-Rom.
#26660 - FluBBa - Wed Sep 22, 2004 10:27 am
Strange... I talked to Sasq yesterday and he said it didn't, I am going to take a look at the code to see what it does.
_________________
I probably suck, my not is a programmer.
#26663 - ampz - Wed Sep 22, 2004 3:07 pm
Well, the RTC support is not perfect..
First of all, Pogoshell ignores the RTC if the RTC is set to operate in AM/PM mode.
So, make sure the RTC operates in 24 hour mode.
In 24 hour mode, pogoshell will detect the RTC and correctly display time between 0:00-11:59.
However, when the RTC is 12:00-23:59, pogoshell (for some reason) adds another 12 hours to the time. 15:00 becomes 27:00, and so on..
Seems to me he requires the RTC to be in 24hour mode, but still adds the AM/PM indicator to the total.
You can use my multiboot RTC utility to view and change RTC settings:
http://www.brolinembedded.se/misc/rtc.mb
(Works for all Pokemon compatible RTCs)
#26679 - FluBBa - Thu Sep 23, 2004 8:43 am
Ok =)
You're not planing to share the code to it?
Sasq told me he only has one implementation of the RTC code, and it does work on VBA and EZ card (and apparently allmost on X-ROM) so it shouldn't be too hard to make a "generic" routine that really works on all cards, should it?
_________________
I probably suck, my not is a programmer.
#26680 - ampz - Thu Sep 23, 2004 9:11 am
I released source code for reading the RTC half a year ago:
http://www.brolinembedded.se/projects/gba_rtc/
The code for setting the RTC is too ugly for someone else than me to see for now... :)
#26681 - ampz - Thu Sep 23, 2004 9:37 am
The bit read by pogoshell's "check_val" is the 12/24 hour mode bit.
If it is 0 the RTC operates in 12 hour mode.
If it is 1 the RTC operates in 24 hour mode.
The bit can be both read and written.
(The most significant bit in the hour-register is the AM/PM indicator when in 12 hour mode)
EDIT
It is as I suspected, pogoshell requires the RTC to operate in 24hour mode (check_val), and then adds the AM/PM indicator to the result anyway:
Code: |
tm->tm_hour = UNBCD(data[4] & 0x3F);
if(data[4] & 0x80)
tm->tm_hour += 12;
|
*****
Here is some info on the features of the RTC:
The command sent to the RTC consist of theese bits:
0110ABCD
0110 are always fixed.
ABC is the register we want to read or write.
D is the read/write bit. (0=write)
The registers:
000: RTC is reset if this register is read or written.
001: Status register.
010: RTC data access 1 (reads/writes year, month, day, dayofweek, hours, minutes, seconds)
011: RTC data access 2 (only reads/writes hours, minutes and seconds)
100: Alarm settings. (Not sure how this works, I think it is supposed to be able to generate a interrupt. Don't think the interrupt pin is connected on any GBA carts anyway)
110: Factory test mode stuff. Not sure how it works, don't touch it.
111: Factory test mode stuff. Not sure how it works, don't touch it.
The status register consists of theese bits: 76543210
7: Power interruption detection. Power has been interrupted if this is 1. RTC needs to be reset to clear this flag.
6: 24/12 hour mode.
5: Alarm enable.
4: Unused.
3: Alarm mode setting something.
2: Unused.
1: Alarm mode setting something.
0: Unused.
#26684 - FluBBa - Thu Sep 23, 2004 3:53 pm
Thanks for the info.
Maybe it's time to put together a doc about it?
_________________
I probably suck, my not is a programmer.
#26695 - dagamer34 - Thu Sep 23, 2004 10:11 pm
Pogoshell RTC works on a EZFA cart?
_________________
Little kids and Playstation 2's don't mix. :(
#26711 - FluBBa - Fri Sep 24, 2004 8:46 am
I'm not sure, aren't there two kinds of EZ? like "just" EZ and EZFA?
The code in Pogoshell looks just like the code I'm using in my emulators, except I check RTCEnable to be 1 after I have written 1 to it.
More info about it after I have done some testing.
_________________
I probably suck, my not is a programmer.
#26718 - ampz - Fri Sep 24, 2004 1:02 pm
Well, except that pogoshell handle 12:00-23:59 kind of weird :-)
There is the EFA, it is not the same as EZFA, but I don't think the EFA has a RTC. Are EZ and EZFA two different things?
#26720 - FluBBa - Fri Sep 24, 2004 1:27 pm
ampz wrote: |
Are EZ and EZFA two different things? |
I don't know =)
Stupid manufacturers choosing the same name just to confuse customers.
I've got the EZ3 now (no FA in that name at least) which should open up for some new possibilitys.
_________________
I probably suck, my not is a programmer.
#26721 - ampz - Fri Sep 24, 2004 1:30 pm
At least the xrom does not have a confusing name.
What are the features of the EZ3?
#26724 - SimonB - Fri Sep 24, 2004 2:01 pm
The Extreme Flash Advance (EFA) has an RTC.
Simon
#26727 - ampz - Fri Sep 24, 2004 2:43 pm
Ok.
#26845 - FluBBa - Mon Sep 27, 2004 10:38 am
The EZ3 has got 256Mbit of NOR flash plus 32Mbit more for bootmenu stuff, 128Mbit RAM and 1024Mbit NAND flash with FAT16 filesystem on it.
And a RTC...
The only change I did in my code to get the RTC to work on the EZ3 was to change the check for RTCEnable to be !=0 instead of ==1.
The RTC in Pokemon gives you a 1 after you have written 1 to it, the EZ3 gives you back something else (sorry about not testing it more).
_________________
I probably suck, my not is a programmer.
#26861 - ampz - Mon Sep 27, 2004 10:06 pm
Only the least significant bit is valid. You must perform a AND operation with 0x0001 to mask out the RTC enable bit before you can compare it to 1.
Usually the other 15 bits are all zeroes, but they don't have to be.
I don't particularly like the NOR+NAND combination carts... It takes quite a while to switch games, and you rewrite the flash memory every time you switch games. Thoose carts usually use Intel flash with a life-expectancy of only 10000 erase operations.
128Mbit battery backed RAM sounds... unlikely... (and highly unnecessary). There must be a catch? Low power 128Mbit SRAM chips don't exactly grow on trees...
#26886 - FluBBa - Tue Sep 28, 2004 10:24 am
The 128Mbit RAM is not battery backed... do you see where this is heading?
It has battery backed ram as well.
The 128Mbit RAM is used instead of the NOR flash so the time switching games is quite small.
They should probably have skipped the NOR flash completly (except for the 32Mbit bootstuff) and just used 256Mbit RAM instead.
The RAM can be bank switched to different regions of the address space, so you can have NOR and RAM in the "rom" area of the GBA I think...
_________________
I probably suck, my not is a programmer.
#26894 - ampz - Tue Sep 28, 2004 1:19 pm
FluBBa wrote: |
The 128Mbit RAM is not battery backed... do you see where this is heading? |
I am. :)
FluBBa wrote: |
They should probably have skipped the NOR flash completly (except for the 32Mbit bootstuff) and just used 256Mbit RAM instead. |
Indeed.
Replacing flash with DRAM is a nice touch. It is probably a decent flash cart.
But I dunno... Simplicity is also a good thing.
#38376 - lotus49 - Sat Mar 26, 2005 8:09 pm
I am currently struggling with the RTC.
I am pretty new to GBA development and I have seen code to access the RTC on my F2AU cart. Unfortunately the one I was able to follow (ie Timmy Brolin's RTC demo) didn't work (all it said was "No RTC detected") and the one that worked (ie Goomba) was all in assembler and I am not yet familiar enough with ARM assembler to extract the relevant bit and compile it.
Has anyone succesfully tested the RTC demo on a F2AU cart? Does anyone have any suggestions as to why it doesn't work on my GBA SP?
TIA
#38516 - ampz - Mon Mar 28, 2005 8:46 pm
lotus49 wrote: |
I am currently struggling with the RTC.
I am pretty new to GBA development and I have seen code to access the RTC on my F2AU cart. Unfortunately the one I was able to follow (ie Timmy Brolin's RTC demo) didn't work (all it said was "No RTC detected") and the one that worked (ie Goomba) was all in assembler and I am not yet familiar enough with ARM assembler to extract the relevant bit and compile it.
Has anyone succesfully tested the RTC demo on a F2AU cart? Does anyone have any suggestions as to why it doesn't work on my GBA SP?
TIA |
My code did not detect the F2AU RTC? That's weird..
Try removing the check for the "RTC enabled" bit. Perhaps they did a cheap implementation and skipped that feedback bit.
#38525 - lotus49 - Mon Mar 28, 2005 10:17 pm
Thanks for replying Timmy - I was hoping you would.
I have now found that there were two problems with my setup.
Firstly, the rtc_detect() code didn't correctly detect my F2AU 1GB cart. The demo didn't work unless I commented out the relevant section of main.c.
However, doing this wasn't enough. There were also problems with the call to scrWaitVSync() at the beginning of the main loop. For some reason that I haven't figured out yet, this doesn't work on my setup and just hangs indefinitely.
The code I have been using to wait for the next vblank is:
volatile u16* ScanLineCounter = (volatile u16*)0x4000006;
void waitVBlank(void)
{
while (!(*ScanLineCounter));
while ((*ScanLineCounter));
}
which seems to work.
I don't know whether the development environment is relevant but I am using HAM and VisualHAM.
However, the end result of this is that I do now have code that I understand that works on my hardware. It does look as though the F2AU RTC is mostly, but not completely compatible with the Pokemon carts, although it does seem strange that I have played Pokemon Sapphire all the way through on this cart and the clock based events worked exactly as expected with no error messages of any sort.
Thanks for your help Timmy, it has been very useful.
#38588 - ampz - Tue Mar 29, 2005 11:19 am
The scrWaitVSync() issue is probably a compiler optimization thing.
Have you tried enabling the rtc_detect() code after you fixed the scrWaitVSync() problem?
#38635 - Kyoufu Kawa - Tue Mar 29, 2005 8:16 pm
Hey, quick question. I have that one C code for RTC support, but how exactly does one -set- the time?
#38639 - lotus49 - Tue Mar 29, 2005 8:38 pm
I haven't tried this yet, but since the detection code happens before the first call to scrWaitVSync() I wouldn't have thought it would make any difference.
I'll give it a go and feedback.
#38678 - ampz - Wed Mar 30, 2005 6:23 am
The detection code, yes, but not the code that writes the result to the screen, right?
#38763 - Kyoufu Kawa - Thu Mar 31, 2005 1:01 pm
This is weird. I got Tim's RTC sample and tried assimilating it...
Considering RTC.C is completely untouched, and I have this in my main code:
Code: |
if(rtc_detect())
//write "enabled" message
else
//write "failed" message
while(1)
{
DoVBlank();
KeyRead();
rtc_init_transfer();
sprintf(mystring, "%02x/%02x/%02x %d %02x:%02x:%02x", rtc_read(), rtc_read(), rtc_read(), rtc_read(), rtc_read(), rtc_read(), rtc_read());
//write mystring to screen
rtc_end_transfer();
if(Trg & A_BUTTON) break;
} |
...why do I get 00/00/00 0 00:00:00?
btw, I still can't fathom the idea of ROM space being writable just like that >_>
#38772 - ampz - Thu Mar 31, 2005 4:51 pm
Kyoufu Kawa wrote: |
This is weird. I got Tim's RTC sample and tried assimilating it...
Considering RTC.C is completely untouched, and I have this in my main code:
Code: | if(rtc_detect())
//write "enabled" message
else
//write "failed" message
while(1)
{
DoVBlank();
KeyRead();
rtc_init_transfer();
sprintf(mystring, "%02x/%02x/%02x %d %02x:%02x:%02x", rtc_read(), rtc_read(), rtc_read(), rtc_read(), rtc_read(), rtc_read(), rtc_read());
//write mystring to screen
rtc_end_transfer();
if(Trg & A_BUTTON) break;
} |
...why do I get 00/00/00 0 00:00:00?
btw, I still can't fathom the idea of ROM space being writable just like that >_> |
The original RTC demo works on your hardware?
#38792 - Kyoufu Kawa - Thu Mar 31, 2005 8:59 pm
The original RTC demo froze up in VBA because it couldn't detect the thing, and my hardware doesn't support it.
Edit: even worse, the damn thing didn't even -start-!
#38805 - ampz - Thu Mar 31, 2005 10:59 pm
If it does not even start then perhaps it just needs a header fix. I don't remember if I distributed the rtc.bin file with or without a valid header.
I have distributed most if not all my binaries without valid headers due to the legal greyzone.
Any of a hundred different program will fix the header for you.
Note that rtc.bin is a multiboot binary.
I made it that way so that you can run it on all kinds of hardware, including original pokemon carts.
#38844 - Fatnickc - Fri Apr 01, 2005 11:08 am
Does anyone know how you change the date/time on an EZFA?
EDIT : Don't worry, Found it is L + R + Start
#38879 - Kyoufu Kawa - Fri Apr 01, 2005 4:41 pm
Well, my header files (romheader.s and crt.s), aside from name and code fields, comes straight from you-know-where, so that can't be it.
It's not multiboot, btw. VBA, currently my only means of testing, has the RTC turned on.
#38907 - lotus49 - Fri Apr 01, 2005 10:17 pm
I can get the code to work fine (with the amendments I referred to earlier in the thread) but it doesn't work on VBA - I get the same result.
#38911 - ampz - Fri Apr 01, 2005 11:20 pm
The rtc.bin file in the .zip file downloadable from: http://www.brolinembedded.se/projects/gba_rtc/ IS a multiboot image.
If you have recompiled the source code to be cart bootable, then that's another thing.
#38982 - Kyoufu Kawa - Sat Apr 02, 2005 9:07 pm
Okay consider this.
I got a non-multiboot game I'm working on and would like it to have an RTC. I use the Library That Shan't Be Named (tm pending), as we all know.
Why does rtc_read() return zeroes?
#38983 - ampz - Sat Apr 02, 2005 9:22 pm
Kyoufu Kawa wrote: |
Okay consider this.
I got a non-multiboot game I'm working on and would like it to have an RTC. I use the Library That Shan't Be Named (tm pending), as we all know.
Why does rtc_read() return zeroes? |
Dunno. Does the original rtc.bin binary work on your hardware?
#39033 - Kyoufu Kawa - Sun Apr 03, 2005 2:49 pm
ampz wrote: |
Dunno. Does the original rtc.bin binary work on your hardware? |
Haha. One, the kid next door has my flash card right now, playing Hamtaro. Two, it doesn't have an RTC.
#39052 - ampz - Sun Apr 03, 2005 10:39 pm
Kyoufu Kawa wrote: |
ampz wrote: | Dunno. Does the original rtc.bin binary work on your hardware? | Haha. One, the kid next door has my flash card right now, playing Hamtaro. Two, it doesn't have an RTC. |
Your hardware does not have a RTC, and you are asking me why rtc_read() is returning zeroes?
I don't know if VBA is emulating a RTC decently enough, try some other RTC software based on my code. Goomba or something. See if they work on VBA.
As a programmer you should know that the question "Why does rtc_read() return zeroes?" cannot be answered. There is simply way too little information given. It is like asking "Why does blabla.exe crash?".
#39096 - Kyoufu Kawa - Mon Apr 04, 2005 2:45 pm
You're right. It's not that high a priority anyway, so I'll just be on my way, thanks.
#39108 - ampz - Mon Apr 04, 2005 5:07 pm
Kyoufu Kawa wrote: |
You're right. It's not that high a priority anyway, so I'll just be on my way, thanks. |
I'd suggest you first try to make the rtc detection routine work. It is very simple. If you get that one to work then you know that you have access to the RTC port.
How RTC detection (and enabling) works:
(optional) Make a 16 bit read from 0x080000c8, LSB of data read should normally be 0.
(mandatory) Make a 16 bit write to 0x080000c8, LSB of data written should be 1.
(verification/detection) Make a 16 bit read from 0x080000c8, LSB of data read should now be 1.
You can disable the RTC again by writing 0 to 0x080000c8
#39119 - Kyoufu Kawa - Mon Apr 04, 2005 6:36 pm
Well, I'll have a quick look then, see if it detects... but I can't do any hardware trials.
#39232 - lotus49 - Wed Apr 06, 2005 9:23 am
I have been playing with the code (as you know) and I have just realised why I was having trouble with it.
On my hardware (F2A Ultra 1Gb) the detection code didn't appear to work (although this may be worth further investigation now) so I removed it. If I then inserted a delay so the time refreshed every 10 seconds rather than every vblank, the very first time the rtc is read, it returns all zeroes. For the second and subsequent reads, it works fine.
I wonder if this it related to not using the detection code but I haven't had time to check. I'll have a look at this tonight if I have time.
#39235 - ampz - Wed Apr 06, 2005 10:43 am
lotus49 wrote: |
I have been playing with the code (as you know) and I have just realised why I was having trouble with it.
On my hardware (F2A Ultra 1Gb) the detection code didn't appear to work (although this may be worth further investigation now) so I removed it. If I then inserted a delay so the time refreshed every 10 seconds rather than every vblank, the very first time the rtc is read, it returns all zeroes. For the second and subsequent reads, it works fine.
I wonder if this it related to not using the detection code but I haven't had time to check. I'll have a look at this tonight if I have time. |
Yes, it think could be related.
The fact that your code works after inserting a 10second delay rather than updating on Vblank suggests that the VBlank detection code is not working properly..
Something that can cause problems in general is optimizing compilers trying to be a bit too clever. Disabling compiler optimization should of course be the first thing you try when you have problems.
#39368 - Dib - Fri Apr 08, 2005 12:43 am
Has anybody ever figured out how to operate the EZFA RTC?
The EZFA in question is the one from gba-toys.com, manufactured by Borden. I ask more out of curiosity than necessity, but considering that I own an EZFA 256 it would definitely be nice to know that it's there for me to use if I get around to it.
I know that Boktai 2, a game heavily reliant on RTC, is able to use it. It tracks date and time successfully on my cart.
#39370 - tepples - Fri Apr 08, 2005 12:55 am
Boktai 2 can talk to the EZFA RTC because the EZFA software patches the Nintendo RTC library. Unfortunately, a year ago, Borden didn't seem to care about homebrewers, who don't have the Nintendo RTC library.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#39374 - Dib - Fri Apr 08, 2005 2:33 am
Ah. I read that post while backreading but it didn't register in relation to this, other than the fact that I already knew Borden doesn't support the cart and refuses to disclose details about it.
#39432 - lotus49 - Fri Apr 08, 2005 8:36 pm
tepples wrote: |
Boktai 2 can talk to the EZFA RTC because the EZFA software patches the Nintendo RTC library. Unfortunately, a year ago, Borden didn't seem to care about homebrewers, who don't have the Nintendo RTC library. |
If I am to be cynical about it, Borden doesn't care about his customers either. The software for the EZFA is decidedly flaky (eg sometimes saver backups are corrupt - I lost a saver for a game I had played for >30 hours due to this) and is no longer being maintained. Borden has long since stopped making an appearance in his own forums. I shan't be buying anything from him again.
#39445 - tepples - Fri Apr 08, 2005 11:35 pm
I'm correct in assuming that Borden has no relation to Borden, right?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#39447 - lotus49 - Fri Apr 08, 2005 11:40 pm
I think that's a pretty safe bet unless he manages to split his time between the Far East and the Mid West. We've seen plenty of cheesy games for the GBA, but cheesy cartridges, that would be an interesting development.