Mega clone SPI bus capacitance issue

Hello all,

This is my first (and very long) post in this forum. I may have included way too much detail and background to explain my inquiries, so if you don't want the background, skip to the start of the **** section (I did so because I am hoping someone might happen to have a better solution than the one I am looking for). If you know of a better forum to post this, suggestions are very welcome.

Problem:
I have made a seemingly foolish mistake and may have loaded my SPI bus with far too much capacitance. I have a PCB with a mega clone that I have designed to control devices on 4 other PCBs over SPI. Each of these four other boards are connected to the mega clone board via ~6" of ribbon cable and each has 20 SPI devices (4 MCP23S17 and 16 DAC8554) When I attach a single board to the mega clone board, SPI comm works fine, but when I attach more than 1 of the device boards to the mega clone board, the MCP23S17's program, but the DAC8554's do not.

~Diagnosis:
My intuition is that this is due to the extra capacitance on the SCK and MOSI lines from the additional board. I measured it and both the SCK and MOSI lines have ~120pF of capacitance each ( :o ). In this Microchip forum post about max number of SPI Slaves, user tunelabguy suggests to keep the capacitive load under 50pF. I am not sure where this suggestion comes from without knowing what device is the master, but my Atmega 2560 seems to do fine with the ~120pF load of one device board. I am curious how to determine the max capacitive load (SPI pins drive strength?) of the Atmega 2560 SPI pins. I figured the SCK and MOSI signals could be slewing so much that it would be ambiguous as the what the data level was at the clock transition, but after putting these lines under the scope (and adding an additional 16pF of capacitance due to the probe) the SCK and MOSI signals are very clearly defined. A screen capture is shown below.

My next concern was rise and fall time of the signals. With one board attached the rise times for both SCK and MOSI were 25ns, with two device boards ~35ns and with three ~40ns. The data sheet for the the MCP23S17 declares a maximum rise time of 2us, and the data sheet for the DAC8554 says "all input signals are specified with t_R = t_F = 3ns (10% to 90% of AV_DD) and timed from a voltage level of (V_IL + V_IH)/2." With my 5V rail I take this to mean 3ns to transition from 2.5V to either 4.5V or 0.5V, but I'm not sure if this is their testing case, typical use case, or maximum. This would explain why the MCP23S17 works but the DAC8554 does not. However, the 25ns rise time of the single working device board case breaks down to ~10ns during 2.5V to 4.5V transition, which is considerably larger than 3ns. The strangest part of all... if i put 22pF of capacitance across MOSI and GND, any number of boards works... I have probes on both MOSI and SCK and they are identical, with or without this magical 22pF cap.

I do not know what is causing this, but this "magic cap" seems to me like a hack of a fix. I feel like i am looking in the wrong place, so I would like to meet the DAC8554's data sheets rise time suggestion if possible.


So here is why I have come to the forum. I found a post where someone was able to speed up the rise time of their pins on a teensy. I am wondering if the SPI pins on my mega clone can be similarly changed to have a faster rise time, or if they are already set in the fastest setting. If so where do I need to alter the arduino code? I am working in Atmel Studio with Visual micro, so essentially Arduino with a more traditional development environment. I would also like to know how to determine the capacitive load capabilities of the SPI pins so I can better plan my next project or my fix to this one.

Thank you!

TodderGuy:
Hello all,

Problem:
I have made a seemingly foolish mistake and may have loaded my SPI bus with far too much capacitance. I have a PCB with a mega clone that I have designed to control devices on 4 other PCBs over SPI. Each of these four other boards are connected to the mega clone board via ~6" of ribbon cable and each has 20 SPI devices (4 MCP23S17 and 16 DAC8554) When I attach a single board to the mega clone board, SPI comm works fine, but when I attach more than 1 of the device boards to the mega clone board, the MCP23S17’s program, but the DAC8554’s do not.

You say your boards connected to one board (star topology) or thru four board (bus topology)?

Show us a picture, and a partial schematic would be nice.

Depending on how you have it organized, you could be seeing reflections, signal bounce, or slow translations.

What kind of test equipment do you have? Hopefully an oscilloscope.

Chuck.

Thank you for your reply chucktodd,

We are indeed using a star topology. I have put together a block diagram of the overall system and the device board attached as PDFs. I have a somewhat old, but seemingly good condition Tektronix TDS 220 oscilloscope (2 channel, 100MHz) and 2 Tektronix P2221 probes. I do not have too much familiarity diagnosing the transmission issues you listed below, so I will definitely need some guidance as to where to probe and how to get a good measurement.

I have attached two oscilloscope pictures I forgot to attach in the original post (both taken at the same DAC8554 pins, nearest to the connector coming from the mega clone board.). The first is with all four boards attached and the second more “ringy” one is with just one board. It looks identical, with or without the “magic cap”, which has all of the sudden stopped working… At least to my untrained eyes I couldn’t spot a difference with or without the “magic cap” so it wasn’t a very satisfying “fix” anyhow. If it truly is a rise time issue, I am definitely going to need some advice as to how to fix that.

System Block Diagram_simplified.pdf (17.7 KB)

System Block Diagram_simplified_device Board.pdf (22.4 KB)

TodderGuy:
Thank you for your reply chucktodd,

We are indeed using a star topology. I have put together a block diagram of the overall system and the device board attached as PDFs. I have a somewhat old, but seemingly good condition Tektronix TDS 220 oscilloscope (2 channel, 100MHz) and 2 Tektronix P2221 probes. I do not have too much familiarity diagnosing the transmission issues you listed below, so I will definitely need some guidance as to where to probe and how to get a good measurement.

I have attached two oscilloscope pictures I forgot to attach in the original post (both taken at the same DAC8554 pins, nearest to the connector coming from the mega clone board.). The first is with all four boards attached and the second more "ringy" one is with just one board. It looks identical, with or without the "magic cap", which has all of the sudden stopped working.... At least to my untrained eyes I couldn't spot a difference with or without the "magic cap" so it wasn't a very satisfying "fix" anyhow. If it truly is a rise time issue, I am definitely going to need some advice as to how to fix that.

Ok,
this is not an electronic Issue. This is a software Issue.

The MCP23S17 uses either SPI_MODE0, or SPI_MODE3, SPI data bits are read when clock goes HIGH, Clock Idle HIGH or LOW.

I would chose MODE3 to work with the DAC.

The DAC8554 uses SPI_MODE2, SPI data bits are read when clock Goes LOW, Idle Clock is High.

This means you have to reconfigure the SPI interface to match which device you are using:

// working with MCP23S17

SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE3));
digitalWrite(MCP23S17_CS,LOW);
//
SPI.transfer();
digitalWrite(MCP23S17_CS,HIGH);
SPI.endTransaction();

// To talk to the DAC's

SPI.beginTransaction(SPISettings(14000000, MSBFIRST, SPI_MODE2));

digitalWrite(DAC_CS,LOW);
//
SPI.transfer();
digitalWrite(DAC_CS,HIGH);
SPI.endTransaction();

The Electronic signals Look acceptable.

Chuck.

chucktodd to the rescue!

I am embarrassed that this one slipped past me, but extremely grateful for your help!!!

I am wondering if the SPI pins on my mega clone can be similarly changed to have a faster rise tim

Just for the record, ATmega AVR chips do NOT have configurable rise-time or pin-drive settings.