23 March 2016

SPI woes

I've been quite busy with other things recently so there hasn't been significant progress for a few days but I do have a few notes of potential interest to share.

I made a start on integrating the display, multiplexer and encoder software into a single executable running on one processor.

Immediately I ran into a quite unexpected problem! The Arduino has a high speed Serial Peripheral Interface (SPI), which permits cooperating devices to share a bidirectional port. Each device is supposed to request service by asserting a hardware select line. Well it doesn't work!

I have three devices that need to access the SPI. 
  1. The Ethernet card
  2. The SD RAM
  3. The Flash ROM which holds the fonts on the display card.
The Ethernet card and SD RAM play nicely together but the display Flash ROM breaks the SPI interface. It's not clear to me yet whether this is the display itself that is at fault or if it is the victim of one of the other users misbehaviour. Anecdotally, the Ethernet card is said to not play nicely and opinion seems to be that most devices tend to behave as if they are the only user of the SPI. Houston, we have a problem!

I'm getting some assistance on the Arduino forum but so far there is no obvious solution in sight. 

Meanwhile, I've returned to my dual Arduino solution, this time using the second Arduino merely as a display processor. It's quite easy to implement a byte-wide parallel interface between the two microcomputers, using 8 data pins and data available/ready lines to handshake byte movement across the interface. A simple protocol to package the display data into a data stream for transmission is straightforward as well.

So that's what I've done. And it works very well. Complete with handshaking I am seeing single byte transfer times around 22us and a typical packet of 12 bytes (a VFO frequency change update) takes 250us to transfer. That's more than adequate.

The display working on a second Arduino (underneath the
display). The 8-bit parallel interface wiring is clearly visible.

I still have to implement data transfer in the opposite direction. It's not even slightly demanding, as the only traffic is touch screen transactions. A simple low speed serial interface will eat that problem without even pausing for breath.

So I have a solution, albeit at the cost of more hardware. Hardware is cheap, so that doesn't bother me but it would be nice to get to the bottom of this SPI problem!


No comments:

Post a comment