Putting the Watch back to Game and Watch

Northsky

Reindeer Whisperer
Feb 8, 2019
23
24
3
Hello all,

I figured it would be fun to share what I've been working on lately. As many of you know, I am quite fond of old gaming consoles. When shopping I noticed that here where I live the new Nintendo Game & Watch Super Mario Bros was on sale, so I bought a few units to play with to learn more about embedded software development. So far I have modded 3 of my units with a bigger external flash memory. These come with 1 MB from the factory, but that is upgradeable. In my case, I used a 16 MB ISSI NOR FLASH SOP-8 chip that happened to be available locally. The particular chip is not compatible with the original firmware of these devices, but I do not care as I've bought these for homebrew purposes. These use a fairly powerful STM32H7 MCU as the heart. Back when I used to work as a contract hardware designer, I almost solely used STM32 chips, so the STM world is quite familiar to me. However, I never did any firmware design for STM32 so this is very interesting way to learn about that topic.

Currently I am working on the retro-go G&W port. What I am doing is implementing RTC support that has been missing so far using the RTC functionality found in the STM32 hardware. Last night I managed to get it work with the external crystal (LSE). It seems that there was a bug in STM32cubeMX that forced the RTC to use LSI clock all the time and also without selecting CBS Sync LSE option any LSE drive options were unavailable. I set the drive to 'high' to make sure that it works. Current usage is negligible compared to low drive.

Here is a screenshot of a menu I created to control the RTC. Now it shows only the time, but I am working on developing controls to set the time. The menu is triggered by pressing the 'TIME' button.

image0.jpg


My ultimate goal with the RTC is to introduce it to the Game Boy emulator so that time passes when you are not playing. At the moment the Game Boy emulator only uses software RTC that only passes time when you are playing a game.

For more information about G&W homebrew, I suggest checking out Stacksmashing's youtube channel!

USB data pins are not connected so for homebrew one needs to use debug pins on the motherboard. I've used stlink v2 (mini) to program my units but I've heard it is also possible to use a raspberry pi to achieve the same, but with slower speed. Also, the stock flash chip is a bit limiting. The homebrew firmware that I am participating in the development of does use a compression mechanism (lz4).

Disclaimer: This post is my own, and not endorsed by Nintendo.
 

Elf

Storybook
Feb 4, 2019
588
161
43
That is pretty fun! As you mentioned earlier it makes a great dev board package for anyone interested in STM32, and it's neat that you can run emulators on it :)

Great job expanding the SPI flash, by the way!
 

KayBee

Member
Feb 24, 2020
86
56
18
That's interesting! Kudos for the memory work. May I ask why the RTC aspect is your "jam?"
 

Northsky

Reindeer Whisperer
Feb 8, 2019
23
24
3
That's interesting! Kudos for the memory work. May I ask why the RTC aspect is your "jam?"
Thanks! Cannot take credit for the Flash memory upgrade, that was figured out by the others. I started working on the RTC aspect because 1.) it was missing from the CFW 2.) implementing it could have a positive effect on power consumption 3.) the Gameboy emulator will need this if SRAM saves and RTC saving is to be implemented.

I managed to finish the watch/calendar functionality yesterday, and I've made a pull request to the main repository. Still a few tweaks could be done, but at least it works. :) Also added a function to return 64-bit Unix timestamp. However, the first half is zeroes so the timestamp is actually 32-bit (seconds). This should be fine for emulator purposes.
 
  • Like
Reactions: Elf

About us

  • Silicon Graphics User Group (SGUG) is a community for users, developers, and admirers of Silicon Graphics (SGI) products. We aim to be a friendly hobbyist community for discussing all aspects of SGIs, including use, software development, the IRIX Operating System, and troubleshooting, as well as facilitating hardware exchange.

User Menu