Close

SD Card SPI

A project log for Z80 Computer

Yet another Z80 computer.

james-otsJames Ots 06/17/2017 at 19:460 Comments

Finally, something slightly more exciting. To me, anyway. I've just got my SD card to respond to a CMD0! I'm not at all pleased with how the CPLD code looks, but it works and I can't work out how to do it better at the moment.

If you send a byte to port 10, the CPLD will transfer it to the SD card, while reading a byte back, which you can then see by reading port 10. You can write to port 11 to change the SD card's CS line, and you can read from it to get the current value of CD and DO, and to see if the CPLD is still busy writing to the SD card.

...and now later in the day...

I've written some Z80 routines which properly initialise the SD card and read some data from it. I don't know if the data is right as I haven't done anything to write to the card yet! Also, it doesn't negotiate anything - I've assumed that everyone that uses this code uses the SD card I have right now!

Discussions