Musings of a Fondue

Non-volatile Memory for the Computer

I’m looking at the SD card reader attached to the Mcufriend LCD shield… and thinking it can act as the non-volatile memory for the Hack computer.

When used with the Arduino SD Library, one can easily read, write, create, and remove files (and directories).

The SD card solution is also very convenient! You can plug the SD card into any regular computer (or phone) and copy onto it any programs you want to run on the Hack Computer (for example these games on Github). (Think game cartridge or USB thumb drive). Similarly, if you write a program and save it onto the SD card when using the Hack Computer, you can then open it up later on any other computer (or phone).

Testing it out

To use the SD card reader with an Arduino there wasn’t much I had to do, just connect the shield to the Arduino and use.

The pinouts are as follow:

Arduino | Mcufriend Shield
  D13   |     SD_SCK
  D12   |     SD_DI  // MISO
  D11   |     SD_DO  // MOSI
  D10   |     SD_SS

I used this tutorial and these ones to get familiar with the SD library. Here is an example test program I put together.

RAM (volatile memory)

Though the SD card can also be used as RAM, I’m thinking of using the RAM* inside the FPGA instead. I imagine access times will be much faster given that the data will have a shorter distance to travel. Also the SD card uses serial communication (bits arrive one at a time), whereas the internal RAM can be configured to communicate in parallel (all bits arrive simultaneously).

*RAM constructed using flip flops as shown in the class. If the flip flop approach proves to be slow, then the FPGA’s dedicated RAM blocks.

To Do

  • Translate the Arduino SD and SPI libraries (and their dependencies) into Hack’s high level language
  • Figure out how to use the RAM blocks in the FPGA