Do you like my hacking? If so, please consider leaving something in the
Fediverse (Mastodon etc): @Sprite_tm@social. spritesmods.com
As you may have guessed, I opted for building a NAND-flash reader from scratch. I wanted a few things that weren't an option on the old parallel port based one:
The easy-connectivity-requirement was the easiest to fill: a while ago, I managed to pick up a TSOP56 ZIF-socket for about ten Euros. The socket has a few more pins than the NAND chips usually have (56 vs 48) but the chip fits perfectly and makes good contact. If you're looking for cheap TSOP48 ZIF-sockets yourself, take a look at e.g. Ebay: there are multiple sellers offering them for EUR10-EUR15.
USB was a bit harder. For the device to be speedy, I'd need at least USB2.0. Not a lot of cheap and easy microcontrollers have that, so one of those would be out of the question. Luckily, I knew about a chip called the FT2232H. This chip is marketed as a dual-port USB2-to-serial converter, but it actually can do a lot more than that: you can do FIFO, JTAG, I2C with it natively, and it also has a so-called 'host emulation mode'. That last mode was of particular interest: it gives you a multiplexed data and address bus with read and write strobes, just like a microcontroller like the 8051 has. The flash chip should be interfacable easily with this, and the 480MBit/s the USB2 chip offered should be enough to be a lot quicker than the parallel port reader.
The FT2232H needs a few parts around it to work, and it's a TQFP chip, so I couldn't
just plug it into a breadboard or prototyping PCB. FTDI does make a module with the
FT2232H on it and all relevant pins connected to headers; modules like this can
be found on eBay too. While the EUR30 this would cost didn't worry me too much, I
knew I could get a quicker result from the loose FT2232H I had stashed away somewhere,
plus one of the TQFP adapter PCBs I had in a box somewhere. All in all, after
a bit of soldering I ended up at this contraption:
On the adapter pcb, I soldered all the components needed for the FTDI-chip to
work in bus-powered mode, like page 53 of the
datasheet
indicates. I then connected the bus pins of the FTDI-chip to the NAND ZIF-socket
like this:
The connections are fairly simple. The data-lines of the FTDI-chip are connected directly to the databus of the NAND-flashchip. The FTDI multiplexes the low address bits on these lines too, but because we don't need them we can ignore that. The read and write strobe run directly to their counterparts on the flash chip too. The ALE and CLE-lines, as well as the write-protect line, connect to the high address lines. This way, by reading from or writing to a particular address, we can set the values of these lines. The R/B-line, a line the flashchip uses to indicate if it's busy with something, is connected to a spare I/O-line.