0

I want to drive numerous chips (L9823, TLC5925, ADG1414, MCP23S08) from an Arduino Micro as well as read input from analog pins connected to momentary buttons, toggles, potentiometers and such. The chips and input controls will be on various boards connected to the Arduino using ribbon cables.

The current idea is to have two sets of 8 pin FFC connectors with the following pins:

FFC digital "bus" conductors:
--
SCLK
VL
SDI
RST
SDO
LE3
LE2
LE1

The clock, VL (5V), SDI and SDO will be shared by both connectors but I still need 6 latches (which can also be commandeered for an interrupt or analog input) and 2 reset pins. This will allow me to run up to 3 types of chips per connector (minus latches used for something else).

I will also have a third 8-conductor FFC connector for 7 analog inputs (the eighth conductor is 5V analog ref).

So my question is, does anyone see any holes in this strategy? I don't think I'm going to try to even breadboard something like this. PCB fab is so easy now (and the first run is always wrong anyway) so I'm just going to make the boards and go from there.

So I just need to settle on what pins to use. Here is a diagram of the Arduino Micro:

Arduino Micro

So the connectors could use pins:

Connector 1 - Digital I/O:
--
SCLK SCK
VL   5V
SDI  MOSI
RST  11
SDO  MISO
LE3  A8
LE2  A7
LE1  SS

Connector 2 - Digital I/O:
--
SCLK SCK
VL   5V
SDI  MOSI
RST  13
SDO  MISO
LE3  A9
LE2  7 (Arduino INT)
LE1  5

Connector 3 - Analog Inputs:

5V
A0
A1
A2
A3
A4
A5
A6

A10 and A11 are reserved for other purposes as well.

Does this look ok?

UPDATE 1:

I have updated the text of this question to consider many of the great comments. The changes include:

  1. Share MISO and MOSI between connectors. Not sure why I thought I needed to use separate ports for the different connectors. SLCK, MISO and MOSI should indeed be shared by both connectors.
  2. Moved 5V to be in between SCK and MISO and moved RST to be in between MISO and MOSI. The idea is that the low impedance of these lines will shield from capacitive crosstalk described by Majenko. The connectors are 1mm pitch which isn't terribly small so hopefully this will not be an issue. It does make routing a little harder since the data pins tend to be next to each other but the same bus is going to connect to multiple boards in a daisy chain fashion so capacitive crosstalk could definitely be an issue. Fortuntely things don't have to run really fast since everything is ultimately for interfacing with humans who are relatively slow.

2 Answers 2

3

The micro only has one SPI bus. It is SCK/MISO/MOSI. You may want a second one, but you don't have one. You can't magic one up out of thin air.

You could emulate one in pure software (bit-banging) but it won't be anywhere near as efficient as using a real hardware one.

Why do you feel you need to have two independent buses anyway? What are you wanting to achieve that you can't achieve with a single shared bus? That same bus can quite happily appear on multiple connectors.

One thing to note with your strategy: Ribbon connectors and SPI don't mix well together. There is a lot of crosstalk and capacitance in a ribbon cable that high speed serial communication really doesn't like. If I had to use ribbon cable for SPI communication for anything longer than a couple of inches I would use twice as many connections and interleave ground between each signal. That is what the ribbon cables for later IDE drives in PCs used to get higher speed, more reliable, communication down ribbon cables.

1
  • 1
    I have a bit-banged SPI library on my page about SPI. For low-ish speeds that could be perfectly acceptable.
    – Nick Gammon
    Commented Mar 29, 2017 at 1:12
0

The MOSI (Master Out Slave In) and MISO (Master In Slave Out) will be much better for your SPI pins. Your SDI (Slave Digital In iirc) will equate to MOSI and your SDO (Slave Digital Out iirc) will equate to MISO. Those are the hardware SPI pins and will be much better than trying to emulate SPI in software.

6
  • But I want 2 buses. Meaning I want 2 channels of SPI so that I can have 2 cables with different latches (2 x 3 = 6 latches). So you can't use other pins for SPI without "emulating"? What about pins 2 and 3. It seems they are used for I2C communication so perhaps they can be jerry rigged for SPI? None of this needs to be terribly fast. Even 125 KHz would be fine I think.
    – squarewav
    Commented Apr 28, 2016 at 18:50
  • Could you have one bus that splits off on your PCB to both connectors? Commented Apr 28, 2016 at 18:52
  • You have SDI and SDO backwards there. SDO is Serial Data Out and is the same as MOSI - SDI is Serial Data In and is MISO. It's the flow of serial data as seen from the master.
    – Majenko
    Commented Apr 28, 2016 at 21:37
  • Thanks. I have updated the question. Yes, I definitely can share MISO and MOSI on both connectors. Not sure why I thought I needed separate pins for that. Also I corrected the reversed MISO and MOSI lines.
    – squarewav
    Commented Apr 29, 2016 at 0:07
  • @Majenko It depends on what datasheet you're looking at in my experience. For example, the MAX31865 IC datasheet here: datasheets.maximintegrated.com/en/ds/MAX31865.pdf has the SDI line as an input to the MAX31865, not as an output to the micro. Commented Apr 29, 2016 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.