I start this thread as a place holder for the Arduboy flash cart project that I’m working on.
Like many others I also fancy playing multiple games on the go. @eried made an awesome looking Arduboy dock to be able to do that and many would love to see SD card support. I gave this a thought too but decided to go for a more console-ish approach: a (game) flash cart.
Not just for a more authentic feel but also because flash is faster and easier to handle for Arduboy than SD cards.
What is this flash cart for Arduboy?
In a nutshell the flash cart is a serial (SPI) flash memory chip hooked up to a voltage levelshifter and Arduboy’s test pads.
Initially the idea was to built it inside Arduboy but with @n602 replacement backplate design and discussing ideas, a removable flash cart was born.
What will it be usable for?
The most important feature will be that a game can be selected from a menu in bootloader mode and that it can be programmed into Arduboy memory right away. No loader app is used wearing down program memory and It takes about a second to program a game. You can follow the development of the custom bootloader that makes this possible here
Another feature will be that sketches can access the flash cart and store additional game data and graphics on it freeing up precious program data in Arduboy program memory.
Schematic - using TXB0104 levelshifter :
Schematic - using diode and resistor level shifter :
Schematic - using flashchip only :
Eagle PCB design
//github.com/MrBlinky/Arduboy/tree/master/flashcart/circuit-board
Proposed connector pinout
Flash cart/ Expansion connector pinout
( (Homemade) Arduboy facing top - front view male pinheader)
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
TX | RX | SCL | SDA | NC | KEY | MISO | MOSI | CLK | RST | GND | Vcc | (original wiring) |
12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
TX | SDA | SCL | RX | NC | KEY | MISO | MOSI | CLK | RST | GND | Vcc | (new wiring) |
Note: Arduboy FX uses the New wiring scheme
TX* - Serial Transmitter output
RX - Serial Receiver input ( Flash cart chip select original wiring)
SCL* - I2C/TWI serial clock I/O
SDA* - I2C/TWI serial data I/O ( Flash cart chip select new wiring)
NC - Not connected (reserved for future use)
KEY - Key pin. should be filled to block pin insertion (reverse insert protection)
MISO - SPI/ICSP Master Input, Slave Output
MOSI - SPI/ICSP Master Output, Slave Input
CLK - SPI/ICSP clock
RST - MCU/ICSP reset
GND - Ground (0V)
Vcc - 5V (~3.0V to ~4.1V on Arduboy)
(*) Not available when using Pro Micro with Alternate Wiring
Example parts / modules
64Mbit / 8Mbyte storage (256+ games):
W25Q64 64Mbit Flash loose chip SOP8 package
W25Q64 64Mbit Flash loose chip DIP package
W25Q64 64Mbit Flash module
128Mbit / 16Mbyte storage (512+ games):
W25Q128 128Mbit Flash loose chip SOP8 package
W25Q128 128Mbit Flash loose chip DIP package
W25Q128 128Mbit Flash module
Adapter board for when using loose chips with SOP8 package
SOP8 to DIP adapter board
Flash storage format
Flash can be read randomly at byte level. But writing to flash is done in pages of 256 bytes and erasing flash in sectors of 4K (4096 bytes). Applications are stored in a number of adjacent pages called a slot. Slots are linked together with a forward and backwards link.
Slot format
- header (1 page)
- title screen (4 pages)
- Optional application code (0 to 116 pages for Cathy3K)
- Optional Application data (0 to 65534 pages)
- Optional save data aligment gap (0 to 15 pages)
- Optional save data (0 to multiple of 16 pages)
Header format
mandatory data
- 7 ARDUBOY signature string
- 1 list number (0 bootloader title screen)
- 2 previous slot page address (0xFFFF for first slot)
- 2 next slot page address
- 2 slot size in pages
- 1 application flash size in 128 byte blocks (0 for none)
optional data
- 2 page address of application program data (0xFFFF none)
- 2 page addr application data file ( 0xFFFF none)
- 2 page addr application save data (0xFFFF none)
- 2
EEPROM start (0xFFFF none)Optional size of application data (in 256 byte pages, mandatory when save data is used) - 2
EEPROM end (0xFFFF none)Reserved (0xFFFF) - 32 SHA256 application signature (calculated over hex file data (before hex file vectors are patched) padded with 0xFF to a multiple length of 256 and fx data (also padded to a multiple of 256 bytes), for categories this area is unused) The use of this signature is for external tools to quickly identify a game and not to check game integrity.
- 199 UTF-8 zero terminated strings:
For applications:
- Application title
- Version
- Developer
- General info or instructions
For categories:
- Category title
- Category information
Numbers are stored in big-endian (Most Significant Byte first) format.
Edit:
added diode-resistor schematic, SHA256 signature to header format, lite-version schematic