[sdiy] Many SPI slave devices on the same PIC master BUS..
Brian Willoughby
brianw at audiobanshee.com
Tue Mar 2 04:56:37 CET 2021
I was trying to remember about bus resistors, and I finally recalled some details.
For I2C, the specification requires pull-ups, and the values need to be dialed in for the desired clock and data rate.
For SPI, I don't think there is a requirement for bus resistors. However, of the four SPI modes (0, 1, 2, 3) you can potentially use pull-down resistors for modes 0 and 1 or pull-up resistors for modes 2 and 3. The real challenge is when you have multiple devices on the same bus which each require a different mode.
I worked on one product where the primary device was mode 3, and so the circuit designers placed pull-up resistors on the SPI bus. But there was a processor attached to the same SPI bus so that we could update its firmware via SPI, and when I went to implement the code I learned that the other chip required mode 0 for firmware updates. I don't think the circuit designers were aware of this when the boards were made. Before we figured out what was wrong, there was a glitch on the clock (and data) line that caused problems. This wasn't obvious until we looked with two different brands of 'scopes. The technical lead manager of this project has a lot of experience, and suggested using an analog 'scope instead of a logic analyzer. That's how we found the glitches. They were barely diverting from ground, but rose enough above 0 V to cause intermittent problems. A logic analyzer only shows 0 and 1, but the analog 'scope showed the glitch. The solution here was to rewrite the Linux SPI driver so it didn't tri-state the SPI pins between transactions. As long as the bus was never allowed to float, there were no unexpected clock edges.
You might not have this problem if you directly control the Chip Select instead of letting a Linux driver have control.
Brian
On Mar 1, 2021, at 18:03, Jean-Pierre Desrochers wrote:
> Hi Brian,
>
> I'm using a PIC16F1783 on a demo board
> connected to a daughter board (solderless connections proto board)
> for the external SPI devices.
>
> And yes the MISO pin could be a problem here.
> Maybe a little pullup (or pull down ) resistor (around 10k) on the MISO
> pin of the master PIC could help..
More information about the Synth-diy
mailing list