Close

µSD -> SPI flash

A project log for GPS Talking Clock

Accurate time without a display

nick-sayerNick Sayer 08/03/2019 at 03:090 Comments

One thing that bugs me a little is that the micro SD cards are a significant expense. Not only do you have to buy the card, but you have to buy the socket for it too.

In principle, there's no real need for removability here. While it would simplify field updates of the audio samples, it doesn't make doing field updates impossible. In addition, it makes the whole system more reliable, since mechanical jolts can't loosen the chip like a card.

We'll stick with using petitFFS and a FAT filesystem, but the diskio layer is far, far simpler - you send a 3 (the read command), a 3 byte start address, and then you read until you're done (yes, in principle you can read the whole chip with one command).

To program the chip, you have to either erase the controller's flash (to keep it from trying to talk to the flash) or hold it in RESET. Since the controller's programmed with PDI, it's necessary to use a separate programming interface for this. I simply chose the traditional AVR ISP pinout, substituting !CS for the !RESET pin. When used for AVR programming, the normal sense of the MOSI and MISO pins are actually reversed - the AVR chip acts like an SPI slave, listening on MOSI and talking on MISO. My intention is to write a little program for the Raspberry Pi's SPI interface to just burn an image file into the chip using just 6 wires hooked up to my 6 pin pogo adapter. Turns out there's a program called "flashrom" which will already do this, and it too supports the Raspberry Pi SPI interface. But it also supports various USB peripherals, so I'm going to try using a Bus Pirate v4 on my mac for this. If that doesn't work, the fall-back is the Pi.

Discussions