Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on Unterminated SPI bus needs expansion board to work properly

Parent

Unterminated SPI bus needs expansion board to work properly

+5
−0

I'm supporting a piece of legacy hardware that routes the SPI bus through a set of headers to an expansion board. Since the expansion board doesn't actually use the SPI bus, we simply ignored the incoming SPI lines when we revised the expansion board.

However, we are now experiencing seemingly random errors on the SPI bus, as it communicates with two devices on the main board. Since there is no source or end termination present on the SPI bus, it makes me wonder if the extra capacitance of the expansion board was enough to prevent reflections.

The main board will not be revised for some time, so I would like to figure out what modification (extra capacitance? resistance?) I could make to the expansion boards that would help prevent SPI reflections, or if there are other possibilities that I'm not thinking of.

I should also mention that this is a low-power, battery-operated system. The top speed for SPI communication on this board is about 1MHz.

It seems like a similar question to this: https://electronics.stackexchange.com/questions/33372/spi-bus-termination-considerations

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Let's check if transmission line effects apply to your SPI bus. What's the raise time of the SPI dig... (3 comments)
Post
+4
−0

At 1 MHz it's probably not transmission line effects.

It's not clear from your question whether the SPI bus works on the main board with the expansion board connected, but not when it's not connected. If so, I expect you're right about the additional capacitance. An easy way to check this is to add a little deliberate capacitance on each SPI line to ground. Perhaps you can do this with an expansion board connector that only has the caps and doesn't connect to any expansion board. Or solder two caps to the bottom of the expansion connector pins.

I'd start with 100 pF caps. If your SPI drivers have 100 Ω output impedance, that's a time constant of 10 ns. 95% settling requires 3 time constants, so 30 ns. You say the SPI bus is running at 1 MHz, so 500 ns levels. 30 ns is a small time compared to that.

If adding deliberate caps instead of the expansion board does make the SPI more robust, then it would be good to understand why. Again, I expect it's not transmission line reflections, especially since it gets better when you make the lines longer. My guess is crosstalk. Capacitance on the lines lowers their impedance at high frequencies, reducing the noise from capacitively coupled edges.

Still, this shouldn't be happening on a reasonably designed circuit board. I suspect the real problem is bad layout. Do you have a board-wide ground plane? Do all ICs have bypass caps between their power and ground pins, physically close to those ICs? Are the SPI lines straight within reason? I expect that after some investigation you'll find the answer to one or more of these questions to be "no".

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Correct, the SPI bus works when the old expansion is connected (lots of extra stray capacitance), and... (4 comments)
Correct, the SPI bus works when the old expansion is connected (lots of extra stray capacitance), and...
TimH‭ wrote almost 2 years ago

Correct, the SPI bus works when the old expansion is connected (lots of extra stray capacitance), and doesn't work when the expansion is removed. This board has a terrible layout, as the original engineer decided he could squeeze lots of ICs onto a 2-layer PCB and also autoroute everything. As a result, MISO and MOSI wander all over the board, and there is definitely no board-wide ground or power plane. I will try adding some capacitance to see if that changes anything, and report back.

Lundin‭ wrote almost 2 years ago

TimH‭ Yikes, you should never use autorouting for... pretty much any purpose, but certainly not for high speed communication lines. Olin's theory of crosstalk being the culprit sounds quite likely. Or in case of 2 layers, maybe ground problems. A picture of the PCB copper layers would be helpful. If you are unlucky, you might have to cut the traces and draw a couple of (twisted together) wires across the board and solder them by hand.

Olin Lathrop‭ wrote almost 2 years ago · edited almost 2 years ago

Saying to "never" use the auto-router is going too far. Auto-routers can be useful tools. But, as with any tool, you have to understand what it's good at and what not, and use it accordingly. You have to know your auto-router, what all the settings do, and make sure you set them appropriately for the board.

I usually hand-route key nets and ground connections, then let the auto-router do the grunt work for the remaining traces, then manually inspect and clean up.

Unless the volumes are really high and every few cents/board matter, use 4 layers and dedicate one layer (usually 2) to a board-wide ground plane. Think of the cost of this problem you are having right now, compared to the cost of having a 4 layer board that just worked. Good engineering costs money, but bad engineering is even more expensive.

TimH‭ wrote almost 2 years ago

Olin Lathrop‭ Thanks for the great answer. We did some testing and found that around 33pF seemed to be ideal for this particular board layout, which reduced the bit error rate by over 99%. Since this is an acceptable amount for our purposes, we'll stop there until we get a chance to completely revise the board, at which point we'll be using 4 layers.