SNES FLASH/ROM

Overview
  

 

…runs custom Super Nintendo code

I wanted to make and play an updated version of NBA JAM to play on SNES hardware, so I made this device.
Load a game ROM to the device over the USB connection and then you’re ready to relive “the best hoops game ever created” (per Electronic Gaming Monthly ’95)!

TL;DR:

The form factor of the device is designed to replace a single 36-pin ROM on an SNES cartridge PCB. The device was designed and tested to be used with the NBA JAM Tournament Edition (SHVC-1A1M-20) PCB. It will not work with the SHVC-BA1M-01 PCB, which some versions of NBA JAM T.E. use, as that board contains 2 ROM chips. It is possible the FLASH/ROM could be used on other SNES cartridge PCBs, as long as the cartridge memory mapping configuration (LoROM/HiROM) agrees with code you would like to run.

Once the original ROM has been removed, the FLASH/ROM can be soldered in its place. If desired, a small notch can be cut on the side of the cartridge housing to expose the USB connector. This will allow you to re-flash the cartridge with new code without having to open the housing again. Special care should be taken to avoid connecting the SNES FLASH/ROM to USB while the cartridge is inserted into an SNES. The physical design of the device, when correctly installed inside a cartridge housing, prevents someone from doing so.

I. Hardware Overview

The device hardware currently consists of an ATMEL atmega32u4 microcontroller (and its associated circuitry), an AMD 29F032B 32-megabit flash memory chip, and 3 octal latches to build up a 21-bit address using only 8 microcontroller pins. Every I/O pin of the microcontroller is used. I chose to use octal latches rather than shift registers for speed purposes. (Shift registers would be slightly slower than using the latches – since I had the pins to use, why not?) It did make routing the signals a little painful, with each latch needing an 8-bit connection to the microcontroller, but it was doable.

The board itself is two-layer, with black soldermask and white silkscreen, and was manufactured by ITead studio, a Chinese PCB fab house. It took about a month for them to arrive. I am pleased with the quality of the boards with respect to the price I paid.

The device is programmed via the ATMEL DFU USB bootloader, which comes pre-loaded from the factory. There are ICSP pads on the PCB also, if one would like to reprogram the microcontroller using an AVR programmer, but in basic operation this is not needed – I put the pads on there for development purposes.

II. Software Overview

The device firmware takes advantage of the excellent LUFA USB stack and uses a Generic HID device profile. Since all modern computer operating systems have Generic HID drivers, this means you don’t need a special one for the FLASH/ROM. The firmware understands commands sent from the PC and processes them appropriately. When the device is first powered on, it defaults to “SNES mode”, which ‘disoconnects’ the microcontroller from the flash chip circuit, to ensure it doesn’t interfere with the SNES reading from the flash chip. If you connect the FLASH/ROM to a computer, the host operating system will detect it as a Generic HID device. Then you run software on the host computer to send commands to the FLASH/ROM. Some example commands include putting the microcontroller into “FLASH mode”, erasing the entire flash chip, and reading/writing data.
The host software uses the HIDAPI library, with a couple hacks to get it working. I couldn’t read the reports sent from the FLASH/ROM correctly using the default interfaces, so I added specific hooks into Windows’ and OS X’s HID functionality. Overall, the quality of my software is pretty bad. It seems to get the job done on Windows, but the OS X version is buggy. Should probably fix that for future versions.