Ethernut Home Hardware Firmware Tools Download Community
EIR  /  SPI Bus
Search | Legals | Deutsch

EIR SPI Support

AT91 Hardware SPI

The SAM7SE offers a single SPI, which is hardwired to the VS1053 audio codec and the AT45DB321 serial flash.

The memory card socket is intentionally not connected to the hardware SPI. When playing or recording MP3 files, memory cards may block the SPI bus for quite some time. If this happens, the audio codec may run out of buffer space. During decoding, this will result in annoying gaps and during encoding the audio recording file may become corrupted.

Bit banging SPI

Actually, any available three GPIO pins can serve as SPI when using a bit banging driver.

Unfortunately, bit banging is quite slow. This had been expected during the design of the board and the memory card socket was attached to the SSC interface. From the data sheet it looks like it should be possible to use SSC for SPI communication, see next chapter.

SPI over AT91 SSC

Although intended early, it turned out, that SSC will not directly work as SPI. No related Nut/OS driver appeared for several years. The problem was, that the receiver, when started once, will not stop after the first byte or word.

Finally a solution was found by driving the receiver from an external clock and connecting this pin to the transmitter clock. This works, because the transmitter will stop when running out of data. The first SPI bus driver for the SSC interface became available in Nut/OS 5.0.5, which allows to read from or write to memory cards at full speed. As explained, this requires a minor hardware modification.

Connecting pin 16 with pin 19 at the port A connector allows to drive the SSC receiver with the SSC transmitter clock.

Return to the EIR project page.