arduFPGA-game, an arduboy/FPGA clone with audio decoder

The board is designed around a LATTICE iCE40UP5K that implement a ATmega32U4 with the necessary IO’s to run unmodified arduboy games, also ( optionally ) includes a VS1053b audio decoder to play music from uSD or create games with more complex sounds.

This board is a derivation of ARDUFPGA ICE40UP5K V1.1 board

in portable format with a size of only 67x42mmin size, smaller than a credit card.

As hardware, there is:

1x LATTICE iCE40UP5K.
1x SSD1306 OLED 128x64 BW display.
1x 2MB of SPI FLASH that the design, the GUI boot-loader and the user application (game) is located, with an endurance of minimum 100K erase/write.
1x 512KB of SPI FLASH for user data, with an endurance of minimum 100K erase/write, this memory is in SO8 package and can be swapped with a SPI RAM memory if the user knows that will write a lot on it.
1x Optionally VS1053b dedicated audio decoder.
1x Electret buzzer.
1x RGB powerfull LED that can be used as flashlight without exiting the played games.
1x Dedicated battery charger with status LED’s.

Design and firmwares:

The games are load from a uSD card thru two stage boot-loader:

The first stage that is written inside the design and has its own 2KBytes of ROM memory and 512Bytes of RAM memory, it has even a dedicated interrupt vector named NMI that interrupt the running game every 1mS and check for INT button to be pressed for at least two seconds, this is a service function that is used to check for a combination of keys to change the LED color or ON-OFF it to act like a flashlight without exiting the game, if no combination of keys are detected the function interrupt the game or running application and load the GUI boot-loader.

Second stage is a GUI explorer/boot-loader that is loaded into the emulated ATmega32U4 program memory running like a normal application or a game and has integrated the FAT FS library, this application check for design and GUI boot-loader updates at startup and update them if user accepts the updates, check and update the design and GUI boot-loader every time a game or application is launch, in case if the running design is custom made for that application or game, when the game or running application is interrupted the GUI boot-loader will automatically save the EEPROM content to the uSD card, and load the EEPROM content from uSD card when a game or application is started, so, all game scores and history is saved if the game is changed.

At this moment all games are in binary format, need to be converted from hex to bin files in order to run.

The design has the capability to increase the size of ROM and RAM memory according to each developer necessities, but no more than 128KB combined.

Different designs, applications source code,boot-loaders source code, user guides, schematic’s and other stuff will be available on:

Of course, design and application ideas are very welcome.

Updates:

I disabled the startup update, has no reason to exist if every time when an application is started it check’s if need to update the design and GUI bootloader.

If you short press the INT button ( between 100mS and 500mS ) the game is interrupted and the EEPROM content is saved to the uSD memory.

If you press INT button more that 500 milliseconds, the keyboard is disconnected from the application, and buttons have other functionalities done by the first stage boot-loader that runs like a bios in background.

The features of the first stage boot-loader are:
INT+ B button change the LED colour B,G,R.
INT+ A button turn ON/OFF the flashlight (RGB led becomes flashlight).
INT+ UP increase the game volume in four steps, from mute to maximum.
INT+ DN decrease the game volume in four steps, from maximum to mute.

All this functionalities at the same tame when you playing games or listen music.

The volume mostly has effect on headphones, the electret buzzer does not react to much to the volume change, the volume is changed using two four bit PWN generators in the design that are connected to PORTA bit [3:2], bit [3:2] of the PWM are connected to ‘0’ and bit [1:0] to PORTA, the real maximum volume is 1/4 of total power to avoid blowing up the listener ears :slight_smile: .

There, on the board, is a VS1053b audio decoder, is waiting to develop an application to run with him :).

The audio connector is connected directly to VS1053b and three pins of the FPGA, this pins are used by the game as audio outputs but alternatively can be used as data communication, one of the pins needing to be put to ‘0’ to provide the ground for the communication.

The micro USB connector is used for charging the battery, alternatively can be used for data communication, three pins of the FPGA are wired to this connector to D+, D- and ID and can have any desired function.

There I accomplish to snick out another wire from the FPGA, this pin I wired it to a 3 pin header and I named it ONE-WIRE header, this header can have the battery power or 3.3V power wired to it.

The current design is a reduced IO, ATmega32u4 compatible core with 64KB of emulated FLASH memory and 32KB of RAM memory, TIM0, TIM3, TIM4, SPI, UART ( incomplete ), emulated EEPROM, extra-reduced PLL ( USB clock generator strip away ), 10bit LFSR RNG as ADC.
System IO’s:

  • PIOA used for design FLASH chip select, application FLASH chip select. external chip select on the ARDVARK connector, and volume control as outputs, all seven keys and LoBat signal as inputs.
  • Ports 0xDB-0xFF used for boot status and FLASH memory write registers.

The external chip select on the ARDVARK connector can be used as CS for an external SPI device connected to ARDVARK connector and in case if the user brick’s the arduFPGA console to recover it using any other arduFPGA console or a regular SPI programmer.

Board consumption from the battery is 29mA with the display at maximum bright ~90% of the pixels active, uSD initialized, RGB LED OFF, and VS1053b in reset mode ( no consumption ).

The board is smaller than a credit card only 68x43x10mm in size and the space in the back of the board close to audio connector can be glued a battery up to 1Amp’s in capacity giving a huge game play/ music listen time for one charge.

Here is a demo:

The board is a little bit fried ( ehh, is the prototype ) :smiley:

2 Likes

Looks interesting. What are the advantages of using an FPGA instead of a real ATmega chip?

Has anyone else ever made an Arduboy clone with uSD support? The gamebuino classic had one so I imagine it could be possible.

If you use a FPGA you can increase the ROM memory in case you have more sprites, you can load them as necessary from an external memory or from uSD (if you include FAT support in the game) without worrying of wearing out the uC FLASH memory, or you can increase the RAM, or both memory’s from design as necessary, you can add custom accelerators for graphics, sounds…, you can run games and applications made for multiple platforms on the same board.

You can add a simple expansion board connected to microUSB connector to output VGA or composite signal generated by an IP included in the FPGA design and not generated by software that runs on the uC and eat a lot of uC cycles.

The running game does not need to know how to work with the uSD to load other games, it uses a dedicated GUI boot-loader, this board is able to run unmodified games made for arduboy.

Later I will add support for 8080, Z80, 6502…

Interested to follow along on this project, thanks for chatting with me @MorgothCreator about it!

I think this would be really cool if you can actually program it with circuit python also, or maybe even… lua? Pico 8? I think if you are going for an FPGA project you should try to make it compatible with many “systems”!

4 Likes

Got it :+1:

Looks like there is a Game & Watch core for MiSTer in the works now too - would be a perfect fit for this! :slight_smile:

1 Like

Yap, they need to develop some serious synchronization with human potential, or prepare him for Musk’s neuro-link :rofl:

I see no details for the project, even on github, I like my eye to scan some code.

1 Like

After a week having my liver eat by customs in my country :smiley: , finally the components and boards for the prototype are beginning to arrive.

Shortly after all components are centralized at my office and I assemble them, I will make available some videos with functionality demos.

If everything is OK ( no design mistakes are made ), several of them will be available for purchase.

1 Like

The boards has arrived,

A preview:

2 Likes

Working on an IDE like scratch to compose designs for arduFPGA iCE40UP5K and arduFPGA-game for a easier way to create designs without coding knowledge :smiley:

It will need some white nights :slight_smile: and a lot of beer…

Done in QT MinGW for cross platform compatibility.

Update:

Ehh, there is a mistake and a connector miscalculation…

Mistake: The Lo Battery LED positive pin is wrongly wired to USB V+ pin instead of general power wire, so when battery becomes low on energy the Lo Battery led only shortly blinks one time and stay OFF, this can be remediated by soldering a SKHOTTKY diode between battery and USB+ to have some voltage on the USB+ from the battery, but is not permissible such a mistake :upside_down_face:

Miscalculation: the battery connector, is to small ( 1.27mm between the pads ), too small to be easily soldered by people, so I will replace it with a 2.54mm one.

In rest, everything works as a charm :crazy_face:

So, the prototype remains the prototype :slight_smile: and no more.

PICO-8 seems very interesting :smiley: , I see that the IDE is designed to create color games, there can be attached a color LCD to the ARDVARK connector and have two displays :upside_down_face: .

As soon as I escape from the import stuff and the boards to be ready for delivery, I will enter to deeper study this problem.

I already begin to develop an scratch like IDE for easy to compose designs according to each developer needs without needing to know RTL programming.

A draft of the user guide for this board has been uploaded:

http://download.devboard.tech/arduFPGA-game-console/arduFPGA_game_console_user-guide.pdf