Hey All,
With talking to multiple slave devices, is there a preferred protocol for how the master selects the slaves?
I guess if I had 8 slave devices, I could use a 3 bit bus and have some kind of decoding logic on each slave device.
Gerard
Hey All,
With talking to multiple slave devices, is there a preferred protocol for how the master selects the slaves?
I guess if I had 8 slave devices, I could use a 3 bit bus and have some kind of decoding logic on each slave device.
Gerard
Hi Gerard,
Thereâs just Chip Select (CS) - one way or another you need a dedicated CS pin for each device. You might be able to do that with some kind of logic circuit that takes a binary input and toggles a suitable pin, to save yourself some GPIO on your microcontroller, but youâll need a pin for each device on the other side.
Thanks for that Oliver. I think I can get it done and will put up my schematic for comment later.
One other issue is how to send/receive digital signalling over 20, 30 or 40 metres. I guess I could use MAX232 devices as itâs all simplex transmission lines.
Ouch, yes SPI wonât go that far. A Differential Signalling protocol like RS485 or RS422 would probably be your best bet (assuming you need more throughput than UART can get you over RS-232).
Yes, I think youâre probably correct.
Iâm a little annoyed with myself that I forgot about making these devices communicable!
Hi Gerard and Oliver.
Over that distance for reliability you would be better off with RS485 which can be half or full duplex. RS422 is pretty much the same but I think only one way, like master and slaves. They are both balanced transmission line and supposedly good for 1200 metres but I think a repeater is recommended before that limit is reached. Donât forget to terminate the cables at the correct place(s).
RS232 using a 3 wire connection and ânormalâ screened cable is only suggested over 2 or 3 metres. You can get our 40 or more by using sort of âbalancedâ wiring techniques and very low capacitance cable. I have used it up to 70 metres plus using low cap cable and DE9 connectors with a 4 wire system but not easy to get the cable in small quantities for a start.
Cheers Bob
Itâs been years since I messed around with RS485 so, naturally, forgot about the terminators. This is the block diagram Iâm working to.
Hi Gerard
Donât know much about SPI (I should try to find out I know) but it is the âBusâ bit that you need to convert to a balanced line system to use over longer distances.
Terminations. The RECEIVER END has to be terminated in 120Ω. If using RS485 in Half Duplex mode that means traffic is transmitted in both directions on the same pair so BOTH ENDS will be receivers and need the termination. Note the terminations only fitted to the ENDS of the cable.
Some adaptors I have noted are pre fitted with a 120Ω termination. This will severely overload the drivers and need to be removed. I donât know why they do this but would be OK if only 2 devices are used. The RS485 bus can handle 32 drops if done correctly. The drivers are designed to operate into a load of 56Ω I think it is (might be 54Ω) which is 2 120Ω resistors and 32 drops all in parallel.
Cheers Bob
Bob,
This is pretty goodâŠ
Serial Peripheral Interface (SPI) - learn.sparkfun.com
Hey All,
So I added the RS485 drivers into my creation of madness.
Iâm not too happy with my selection of an SN75176 which is an 8 pin DIP with one RX and one TX. On the Controller side (what used to be termed Master), I need 5 TX and one RX/TX (for COPI/CIPO signalling) .
Any suggestions for a better alternative?
Have a browse through Maximâs catalogue: RS-485 and RS-422 Transceivers | Maxim Integrated
Iâm sure youâll find something.
MOSI/MISO (for Master/Slave Out/In) is the correct terminology.
I know there are some people on a vendetta to try and eliminate the use of master/slave in all technical fields because they believe the subject of human slavery (and anything that even reminds them of it) should be taboo and never discussed, but this is a communications protocol, not human slavery.
Theyâre well intentioned but very confused and misguided, and youâll find yourself having to use MOSI/MISO to explain what you mean anyway (like you did here), so itâs better to just stick with the correct names upfront and prevent confusion, and not encourage the whole mess.
Technical jargonâs hard enough to learn as is.
Hi Oliver,
Yes, I hear you about the MISO>CIPO thing. I must admit that I never had connected the terms to human slavery.
With the RS 485/422 thing. I donât need a high data rate so that improves my selection criteria.
Gerard
Hey Guys,
I had an interesting thought!
What I could do is send SS to every slave device. The first byte of transmitted data from the master instructs which of the 15 slaves is to respond. I reckon that might save 4 packages and the coding would only be marginally more complex (sending an extra byte of data)
Thoughts?
Gerard