SPI Application
This application allows for communication by SPI, the Serial Peripheral Interface. Use the following pinout, which is very similar to the JTAG pinout.
Clients
A Python client, goodfet.spiflash, is quite effective at reading, writing, and erasing SPI flash chips.
In addition to that, another client, goodfet.zensys, is dedicated to Zensys Z-Wave ASICs and provides read/write/erase capabilities.
Development
Prior to any transactions, the SETUP (0x10) verb should be sent to the SPI application to properly set the I/O directions.
SPI is based upon the exchange of information as a duplex transaction. As such, the READ (0x00) and WRITE (0x01) verbs are identical. Each transmits the bytes of the data buffer through MOSI, returning the result through MISO. !SS is dropped low at the beginning of a transaction, then raised after all bytes have been exchanged.
There is also a full tutorial for the SPI application.
Verbs
The following verbs are supported. The Write-Enable command is implied by those that write flash memory, such as POKE and SPI_ERASE.
Hex | #define | Description |
---|---|---|
0x00 | READ | Exchange data. |
0x01 | WRITE | Exchange data. |
0x02 | PEEK | Read 64 bytes from supplied 24-bit address. |
0x03 | POKE | Write data to flash at 24-bit address. |
0x10 | SETUP | Configure I/O pins. |
0x20 | START | Start a transaction. |
0x21 | STOP | Stop a transaction. |
0x7E | NOK | No Operation |
0x80 | SPI_JEDEC | Grab 3-byte JEDEC ID. |
0x81 | SPI_ERASE | Erase a Flash EEPROM. |
0x82 | SPI_RW_EM260 | SPI exchange with an EM260. |
0x83 | SPI_ZENSYS_ENABLE | Zensys "Program enable" command. |
0x84 | SPI_ZENSYS_WRITE3_READ1 | Zensys specific command that reads 1 byte of flash. |
0x85 | SPI_ZENSYS_WRITE2_READ2 | Zensys specific command that reads 2 bytes of flash. |