Advice on connector pin out (SPI bus + Power) - Page 1
Forum section: electronics / projects

author: danielbriggs
author_rank: Regular Contributor
timestamp: October 12, 2020, 02:08:43 am
content: Hi there,I wondered if I could ask for some advice on the best way to pick a pinout for a connector for a project I'm working on // if what I am planning is sensible.Short:Is it wise to bunch up all data pins consecutivly with one GND conductor, or interlace them with GND's every other pin?Long:I have a dozen sensors each communicating over SPI @48MHz bus speed, controlled by one central micro, and each of these sensor nodes are separate physical units inside an overall large enclosure. The maximum distance between all nodes from the central controller is 1m. While it would be very nice to daisy chain all the nodes, I think this would be problematic (although please correct me if I'm wrong).So I'm planning to use a star topology with each sensor node making a point-to-point connection with the main micro-board. This adds more wire clutter inside the enclosure, and takes up more connector space on the main controller, but I believe this will give me central point grounding, and consistent wire lengths so there is no skew on the (relatively fast, - by my standards at least!) SPI bus. Please correct me if this is wrong.So the signals to go out to each sensor node are SPI-CLK, SPI-MOSI, SPI-MISO, SPI-SS and 1x GPIO line . AND 24V and GND for power. (There is an onboard DC-DC on each sensor node to make required voltages).By my maths this is a total of 7 signals, and naive me would have said "ok a 7-way connector will do". However after absorbing 1% of Johnson's High speed digital design - black magic, I feel this might be non-optimal especially as there's a relatively fast SPI bus on there. I've read a few suggestions of staggering GND's between every other signal pin. Would you reccomend this applies here?GND's every even pin, brings the total to 12-way wire-to-board connectors. Sensible + the way to go, or a waste of time, and keep it to the bare minimum of 7-way connectors?Bonus question:Is it wise to put both fast SPI signal and power (24V @ ~200mA) on the same cable assembly or a massive no-no? My aim was to keep it simple for wiring to each node, but if there's a good electrical reason to separate such then I can split it out to two cable assemblies.I was planning to use 1.5mm JST ZH series for reference.Any advice / pointers greatly appreciated.All the best,Dan

author: jbb
author_rank: Super Contributor
timestamp: October 12, 2020, 08:27:25 am
content: Err, 48 MBit/s over 1m could be a little difficult.Some scoping questions:Could you sketch what you'd like for a daisy chain and how you might do a star topology? A sketch can help a lotWhat sort of other stuff is in the cabinet (or nearby)? DC motors? Tesla coil? Induction furnace? Arc furnace? Medical equipment?An SPI link suggests you're connecting to some kind of IO chip. What could happen if a few bits of the SPI communication get flipped or a wire falls off? Could software fix that? Would reboot be require? Would something catch fire?Would these cables be hot-plugged (i.e. plugged & unplugged while 24V power on)?

author: Siwastaja
author_rank: Super Contributor
timestamp: October 12, 2020, 08:39:18 am
content: 48Mbps SPI over 1m of wire is very challenging, SPI is not supposed to be used for this purposeat all.This being said, if you want to try, I would recommend the following:* Twisted pairs (like CAT5) where the pairs are MISO+GND, MOSI+GND, SCK+GND, NCS+GND; or* flat flex cable, ribbon cable or similar, whereevery otherconductor will be ground. Pinout like GND, VCC, GND, n x [VCC, GND, ] if more power is needed, then MISO, GND, MOSI, GND, SCK, GND...Approximate the transmission line impedance, for 0.5mm FFC with ground-signal-ground-signal it's somewhere around 70 ohms.Then, use 4-layer PCB on each end. Use a web calculator for trace width (knowing the prepreg thickness of the PCB stackup), matching it to the cable as well as your guesstimate of the cable impedance allows.Then, use source (series) termination resistors. Subtract approx. 20-30 ohms for the IO pin ESR. So in practice this would be some 33R to 56R; experimentation and signal integrity measurements are needed. These resistors go at the driving end; so with MISO, it's right at the slave's pin, three others are at the master.Do not share the bus, only point-to-point allowed (otherwise the source termination doesn't work as expected). Pick a master MCU with a lot of SPI peripherals; if this doesn't work out, use bus switch/matrix ICs to isolate all except one path at a time.It's OK to combine a few slaves to the same bus if they are afew cmfrom each other on the same PCB.Finally, re-evaluate if you really need 48MHz. Going slower will allow you to slow down edges more, by increasing R and/or adding small filter C at the receiving end.

author: jbb
author_rank: Super Contributor
timestamp: October 12, 2020, 09:44:30 am
content: Quote from: Siwastaja on October 12, 2020, 08:39:18 amYep. What he said. You're getting into transmission lines, which is doable but needs some care. Connectors will be quite important, because you'll need controlled impedance.Two options come to mind:You could do SPI messages over Low Voltage Differential Signalling (LVDS). Differential is good for emitting less noise from your equipmentand. Multidrop LVDS (M-LVDS, MLVDS) might allow for a daisy-chain cable approach but would have greater risk of problems.If you can slow down to 1Mbit/s, Analog Devices (aka Linear Tech) make something interesting: theLTC6820isoSPI interface. This uses assorted modulation tricks and isolation transformers to squeeze an SPI connection through a single twisted pair

author: danielbriggs
author_rank: Regular Contributor
timestamp: October 12, 2020, 12:16:20 pm
content: Thank you both for taking the time to reply + educate me; really appreciate it.Quote from: jbb on October 12, 2020, 08:27:25 amFor sure, I've sketched out the use case here:For reference, I've made a previous incarnation of this system with a slower 1MHz SPI bus in a daisy chained fashion, and it works very well. However there is a need to update the system + replace with newer sensors that require a faster transmission rate, so I would like to do whatever I can to engineer this 48MHz bus properly.I have rethought the positioning slightly, and by placing the controller in the middle of the nodes, I can shorten the cable length to 500mm from MCU to each node.Quote from: Siwastaja on October 12, 2020, 08:39:18 amThank you, that confirms my suspicion of needing the extra interleaved GND's.Quote from: Siwastaja on October 12, 2020, 08:39:18 amQuote from: Siwastaja on October 12, 2020, 08:39:18 amThank you for this; most helpful. I've never designed a 4-layer board, but was intending to make this my first (for the various benefits I've read about). Planned: SIGNAL, GND, VCC, SIGNAL stackup.Quote from: jbb on October 12, 2020, 08:27:25 amI've never heard of such a product before; thanks for the heads up on that. I'll give it a good read, and useful to know if even not for this project.Quote from: jbb on October 12, 2020, 08:27:25 amNothingtoonoisy like that. Just an off the shelf AC-DC switching PSU.Quote from: jbb on October 12, 2020, 08:27:25 amNo hot-plugging.All the best,Dan

author: voltsandjolts
author_rank: Unknown
timestamp: October 12, 2020, 12:22:25 pm
content: Maybe at 500mm line length you can get away with this, but then the client changes specification and wants 2m.Can you put a microcontroller at every 'node' and have slower communications link back to the central controller?

author: danielbriggs
author_rank: Regular Contributor
timestamp: October 12, 2020, 12:47:03 pm
content: Quote from: voltsandjolts on October 12, 2020, 12:22:25 pmI thought about doing this, and looked at a system with like you said a MCU at each node, and CAN bus for them all to communicate on (Similar to the Omzlo implementation).But to keep it simple, opt'd for a central MCU on this 0.5/1.0m system; there is no scope to do bigger system in my eyes. Any larger and it would need a different decentralised approach (CAN etc.)Thanks for your thought on this though.