Electronics-Related.com
Forums

Shared Communications Bus - RS-422 or RS-485

Started by Ricky November 2, 2022
On Wednesday, November 2, 2022 at 7:34:03 AM UTC-4, Arie de Muijnck wrote:
> On 2022-11-02 06:30, Ricky wrote: > > I have a test fixture that uses RS-232 to communicate with a PC. It actually uses the voltage levels of RS-232, even though this is from a USB cable on the PC, so it's only RS-232 for maybe four inches. lol > > > > I'm redesigning the test fixtures to hold more units and fully automate a few features that presently requires an operator. There will now be 8 UUTs on each test fixture and I expect to have 10 to 20 test fixtures in a card rack. That's 80 to 160 UUTs total. There will be an FPGA controlling each pair of UUTs, so 80 FPGAs in total that the PC needs to talk to. > > > > Rather than working on a way to mux 80 RS-232 interfaces, I'm thinking it would be better to either daisy chain, or connect in parallel all these devices. The protocol is master-slave where the master sends a command and the slaves are idle until they reply. The four FPGAs on a test fixture board could be connected in parallel easily enough. But I don't think I want to run TTL level signals between so many boards. > > > > I could do an RS-422 interface with a master to slave pair and a slave to master pair. The slaves do not speak until spoken to, so there will be no collisions. > > > > RS-485 would allow all this to be over a single pair of wires. But the one big issue I see people complain about is getting PC software to not clobber the slaves, or I should say, to get the master to wait long enough that it's not clobbering it's own start bit by overwriting the stop bit of the slave. I suppose someone, somewhere has dealt with this on the PC and has a solution that doesn't impact bus speed. I run the single test fixture version of this at about 100 kbps. I'm going to want as much speed as I can get for 80 FPGAs controlling 160 UUTs. Maybe I should give that some analysis, because this might not be true. > > > > The tests are of two types, most of them are setting up a state and reading a signal. This can go pretty fast and doesn't take too many commands. Then there are the audio tests where the FPGA sends digital data to the UUT, which does it's thing and returns digital data which is crunched by the FPGA. This takes some small number of seconds and presently the protocol is to poll the status until it is done. That's a lot of messages, but it's not necessarily a slow point. The same test can be started on every UUT in parallel, so the waiting is in parallel. So maybe the serial port won't need to be any faster. > > > > Still, I want to use RS-422 or RS-485 to deal with ground noise since this will be spread over multiple boards that don't have terribly solid grounds, just the power cable really. > > > > I'm thinking out loud here as much as anything. I intended to simply ask if anyone had experience with RS-485 that would be helpful. Running two wires rather than eight would be a help. I'll probably use a 10 pin connector just to be on the safe side, allowing the transceivers to be used either way. > > > I've built test systems like that, without any PC master timing problems. > > Use a 2-pair RS485 bus, one pair for PC TX, one for PC RX. > Use independent RX and TX. On PC side enable TX at all times. > Use a 120R terminator on each end of each pair. > Use one 560R pull-up and 560R pull-down on the RX pair to keep the RX bus noise-free when idle. > > On the device side use separate RS485 RX and TX, enable TX only when replying (and turn off AFTER the stop bit). > > Use Hi-Z RS485 chips, they can handle multi drop up to 256 connections. > > Worked perfectly, even with up to 5V ground differences. > Tested in production environment, CRC error counters stayed zero.
Just to be clear, if the talking and listening aren't on the same wires, that just RS-422, not RS-485. No? But yes, that's one very good option. What bit rates were you using? -- Rick C. -+- Get 1,000 miles of free Supercharging -+- Tesla referral code - https://ts.la/richard11209
On Wednesday, November 2, 2022 at 8:54:17 AM UTC-4, Arie de Muijnck wrote:
> On 2022-11-02 13:05, Lasse Langwadt Christensen wrote: > > > onsdag den 2. november 2022 kl. 12.34.03 UTC+1 skrev Arie de Muijnck:>> I've built test systems like that, without any PC master timing problems.>>>> Use a 2-pair RS485 bus, one pair for PC TX, one for PC RX.>> Use independent RX and TX. On PC side enable TX at all times.>> Use a 120R terminator on each end of each pair.>> Use one 560R pull-up and 560R pull-down on the RX pair to keep the RX bus noise-free when idle.> > which is basically RS-442> > If you meant RS-422: no, that has no three-state so cannot be used for multi-drop. > The two-pair topology is indeed like RS-422 but made multi-slave with RS-485 drivers.
This is not important, but all the RS-422 devices I've used have driver enables. There's one on the UUT, that has become unobtainium, and is a PITA, because it's a 5V device and has to connect to 3.3V logic. They can be used for RS-485 simply by connecting a driver and receiver to the same pair of lines. RS-485 devices typically wire the driver and receive to the same pins, so they fit in an 8 pin package. -- Rick C. -++ Get 1,000 miles of free Supercharging -++ Tesla referral code - https://ts.la/richard11209
On 2022-11-02 20:40, Ricky wrote:
> On Wednesday, November 2, 2022 at 7:34:03 AM UTC-4, Arie de Muijnck wrote: >> I've built test systems like that, without any PC master timing problems. >> >> Use a 2-pair RS485 bus, one pair for PC TX, one for PC RX. >> Use independent RX and TX. On PC side enable TX at all times. >> Use a 120R terminator on each end of each pair. >> Use one 560R pull-up and 560R pull-down on the RX pair to keep the RX bus noise-free when idle. >> >> On the device side use separate RS485 RX and TX, enable TX only when replying (and turn off AFTER the stop bit). >> >> Use Hi-Z RS485 chips, they can handle multi drop up to 256 connections. >> >> Worked perfectly, even with up to 5V ground differences. >> Tested in production environment, CRC error counters stayed zero. > > Just to be clear, if the talking and listening aren't on the same wires, that just RS-422, not RS-485. No? > But yes, that's one very good option. What bit rates were you using?
The two-pair topology is like RS-422. The three-stating levels are RS-485. This is a hybrid system. I used about 400 kbps, but if you use small stubs, proper termination and not too long a cable, 1+ Mbps is possible. A chip like https://www.ti.com/product/THVD1424 would do: 3.3/5V, full duplex, enables, 20 Mbps, 256 nodes, $1 at 1K+. But there are cheaper ones, a searching link including filters is: https://www.ti.com/interface/rs-485-rs-422/products.html#p994=0;1&p993=0;1.67&p1065=Half&p1064=95;320&o4=1&sort=p1130;asc Arie
RS485 is simple, reliable and can run quite fast, if you really need more bandwidth you could just split the string and add more interfaces to the PC
On 2022-11-03 00:09, Lasse Langwadt Christensen wrote:
> RS485 is simple, reliable and can run quite fast, if you really need more bandwidth you could just split the string and add more interfaces to the PC
Ricky wants to communicate with a PC. RS-485 does not handle the timing from the standard PC UART signals well, the disabling of the TX after the last character is a problem. Black-box did that with retriggerable one-shots from the TX signal, they had to be set for the proper baudrate. Even then, the slave cannot answer directly but has to provide some dead time before answering. However, some RS-485 USB dongles have proper TX enabling control by the UART chip inside, they turn off just after the last stop bit. That leaves only the slave timing to be considered, and terminators plus pull-ups / pull-downs. Arie
On Wednesday, November 2, 2022 at 6:12:49 PM UTC-4, Arie de Muijnck wrote:
> On 2022-11-02 20:40, Ricky wrote: > > On Wednesday, November 2, 2022 at 7:34:03 AM UTC-4, Arie de Muijnck wrote: > >> I've built test systems like that, without any PC master timing problems. > >> > >> Use a 2-pair RS485 bus, one pair for PC TX, one for PC RX. > >> Use independent RX and TX. On PC side enable TX at all times. > >> Use a 120R terminator on each end of each pair. > >> Use one 560R pull-up and 560R pull-down on the RX pair to keep the RX bus noise-free when idle. > >> > >> On the device side use separate RS485 RX and TX, enable TX only when replying (and turn off AFTER the stop bit). > >> > >> Use Hi-Z RS485 chips, they can handle multi drop up to 256 connections. > >> > >> Worked perfectly, even with up to 5V ground differences. > >> Tested in production environment, CRC error counters stayed zero. > > > > Just to be clear, if the talking and listening aren't on the same wires, that just RS-422, not RS-485. No? > > But yes, that's one very good option. What bit rates were you using? > The two-pair topology is like RS-422. The three-stating levels are RS-485. This is a hybrid system. > > I used about 400 kbps, but if you use small stubs, proper termination and not too long a cable, 1+ Mbps is possible. > A chip like https://www.ti.com/product/THVD1424 would do: 3.3/5V, full duplex, enables, 20 Mbps, 256 nodes, $1 at 1K+. > > But there are cheaper ones, a searching link including filters is: > https://www.ti.com/interface/rs-485-rs-422/products.html#p994=0;1&p993=0;1.67&p1065=Half&p1064=95;320&o4=1&sort=p1130;asc
This one is plenty cheap enough, but "Out of stock", like many, many devices these days. -- Rick C. +-- Get 1,000 miles of free Supercharging +-- Tesla referral code - https://ts.la/richard11209
torsdag den 3. november 2022 kl. 00.21.30 UTC+1 skrev Arie de Muijnck:
> On 2022-11-03 00:09, Lasse Langwadt Christensen wrote: > > RS485 is simple, reliable and can run quite fast, if you really need more bandwidth you could just split the string and add more interfaces to the PC > Ricky wants to communicate with a PC. > RS-485 does not handle the timing from the standard PC UART signals well, the disabling of the TX after the last character is a problem. Black-box did that with retriggerable one-shots from the TX signal, they had to be set for the proper baudrate. Even then, the slave cannot answer directly but has to provide some dead time before answering. > > However, some RS-485 USB dongles have proper TX enabling control by the UART chip inside, they turn off just after the last stop bit. That leaves only the slave timing to be considered, and terminators plus pull-ups / pull-downs. >
just get something like an FTDI USB to RS485 serial interface cable, it does the correct timing and has pull up/down and optional termination actual PC UARTs are something you find in a technical museum
torsdag den 3. november 2022 kl. 00.34.39 UTC+1 skrev Ricky:
> On Wednesday, November 2, 2022 at 6:12:49 PM UTC-4, Arie de Muijnck wrote: > > On 2022-11-02 20:40, Ricky wrote: > > > On Wednesday, November 2, 2022 at 7:34:03 AM UTC-4, Arie de Muijnck wrote: > > >> I've built test systems like that, without any PC master timing problems. > > >> > > >> Use a 2-pair RS485 bus, one pair for PC TX, one for PC RX. > > >> Use independent RX and TX. On PC side enable TX at all times. > > >> Use a 120R terminator on each end of each pair. > > >> Use one 560R pull-up and 560R pull-down on the RX pair to keep the RX bus noise-free when idle. > > >> > > >> On the device side use separate RS485 RX and TX, enable TX only when replying (and turn off AFTER the stop bit). > > >> > > >> Use Hi-Z RS485 chips, they can handle multi drop up to 256 connections. > > >> > > >> Worked perfectly, even with up to 5V ground differences. > > >> Tested in production environment, CRC error counters stayed zero. > > > > > > Just to be clear, if the talking and listening aren't on the same wires, that just RS-422, not RS-485. No? > > > But yes, that's one very good option. What bit rates were you using? > > The two-pair topology is like RS-422. The three-stating levels are RS-485. This is a hybrid system. > > > > I used about 400 kbps, but if you use small stubs, proper termination and not too long a cable, 1+ Mbps is possible. > > A chip like https://www.ti.com/product/THVD1424 would do: 3.3/5V, full duplex, enables, 20 Mbps, 256 nodes, $1 at 1K+. > > > > But there are cheaper ones, a searching link including filters is: > > https://www.ti.com/interface/rs-485-rs-422/products.html#p994=0;1&p993=0;1.67&p1065=Half&p1064=95;320&o4=1&sort=p1130;asc > This one is plenty cheap enough, but "Out of stock", like many, many devices these days.
LCSC have million of transceivers in stock https://lcsc.com/products/RS-485-RS-422-ICs_578.html and most of the SO8 rs-485 ones are likely pin compatible
On Wednesday, November 2, 2022 at 7:56:34 PM UTC-4, lang...@fonz.dk wrote:
> torsdag den 3. november 2022 kl. 00.34.39 UTC+1 skrev Ricky: > > On Wednesday, November 2, 2022 at 6:12:49 PM UTC-4, Arie de Muijnck wrote: > > > On 2022-11-02 20:40, Ricky wrote: > > > > On Wednesday, November 2, 2022 at 7:34:03 AM UTC-4, Arie de Muijnck wrote: > > > >> I've built test systems like that, without any PC master timing problems. > > > >> > > > >> Use a 2-pair RS485 bus, one pair for PC TX, one for PC RX. > > > >> Use independent RX and TX. On PC side enable TX at all times. > > > >> Use a 120R terminator on each end of each pair. > > > >> Use one 560R pull-up and 560R pull-down on the RX pair to keep the RX bus noise-free when idle. > > > >> > > > >> On the device side use separate RS485 RX and TX, enable TX only when replying (and turn off AFTER the stop bit). > > > >> > > > >> Use Hi-Z RS485 chips, they can handle multi drop up to 256 connections. > > > >> > > > >> Worked perfectly, even with up to 5V ground differences. > > > >> Tested in production environment, CRC error counters stayed zero. > > > > > > > > Just to be clear, if the talking and listening aren't on the same wires, that just RS-422, not RS-485. No? > > > > But yes, that's one very good option. What bit rates were you using? > > > The two-pair topology is like RS-422. The three-stating levels are RS-485. This is a hybrid system. > > > > > > I used about 400 kbps, but if you use small stubs, proper termination and not too long a cable, 1+ Mbps is possible. > > > A chip like https://www.ti.com/product/THVD1424 would do: 3.3/5V, full duplex, enables, 20 Mbps, 256 nodes, $1 at 1K+. > > > > > > But there are cheaper ones, a searching link including filters is: > > > https://www.ti.com/interface/rs-485-rs-422/products.html#p994=0;1&p993=0;1.67&p1065=Half&p1064=95;320&o4=1&sort=p1130;asc > > This one is plenty cheap enough, but "Out of stock", like many, many devices these days. > LCSC have million of transceivers in stock https://lcsc.com/products/RS-485-RS-422-ICs_578.html > > and most of the SO8 rs-485 ones are likely pin compatible
The trouble is, I'm not using RS-485. I guess I could use two of these chips and never enable the driver on the receiver part. They have nothing in stock that's actually RS-422 with a separate driver and receiver, also, some level of ESD protection. But thanks for the pointer. I tend to not use LCSC. These days, even they don't have much in stock. -- Rick C. +-+ Get 1,000 miles of free Supercharging +-+ Tesla referral code - https://ts.la/richard11209
torsdag den 3. november 2022 kl. 01.25.31 UTC+1 skrev Ricky:
> On Wednesday, November 2, 2022 at 7:56:34 PM UTC-4, lang...@fonz.dk wrote: > > torsdag den 3. november 2022 kl. 00.34.39 UTC+1 skrev Ricky: > > > On Wednesday, November 2, 2022 at 6:12:49 PM UTC-4, Arie de Muijnck wrote: > > > > On 2022-11-02 20:40, Ricky wrote: > > > > > On Wednesday, November 2, 2022 at 7:34:03 AM UTC-4, Arie de Muijnck wrote: > > > > >> I've built test systems like that, without any PC master timing problems. > > > > >> > > > > >> Use a 2-pair RS485 bus, one pair for PC TX, one for PC RX. > > > > >> Use independent RX and TX. On PC side enable TX at all times. > > > > >> Use a 120R terminator on each end of each pair. > > > > >> Use one 560R pull-up and 560R pull-down on the RX pair to keep the RX bus noise-free when idle. > > > > >> > > > > >> On the device side use separate RS485 RX and TX, enable TX only when replying (and turn off AFTER the stop bit). > > > > >> > > > > >> Use Hi-Z RS485 chips, they can handle multi drop up to 256 connections. > > > > >> > > > > >> Worked perfectly, even with up to 5V ground differences. > > > > >> Tested in production environment, CRC error counters stayed zero. > > > > > > > > > > Just to be clear, if the talking and listening aren't on the same wires, that just RS-422, not RS-485. No? > > > > > But yes, that's one very good option. What bit rates were you using? > > > > The two-pair topology is like RS-422. The three-stating levels are RS-485. This is a hybrid system. > > > > > > > > I used about 400 kbps, but if you use small stubs, proper termination and not too long a cable, 1+ Mbps is possible. > > > > A chip like https://www.ti.com/product/THVD1424 would do: 3.3/5V, full duplex, enables, 20 Mbps, 256 nodes, $1 at 1K+. > > > > > > > > But there are cheaper ones, a searching link including filters is: > > > > https://www.ti.com/interface/rs-485-rs-422/products.html#p994=0;1&p993=0;1.67&p1065=Half&p1064=95;320&o4=1&sort=p1130;asc > > > This one is plenty cheap enough, but "Out of stock", like many, many devices these days. > > LCSC have million of transceivers in stock https://lcsc.com/products/RS-485-RS-422-ICs_578.html > > > > and most of the SO8 rs-485 ones are likely pin compatible > The trouble is, I'm not using RS-485. I guess I could use two of these chips and never enable the driver on the receiver part. They have nothing in stock that's actually RS-422 with a separate driver and receiver, also, some level of ESD protection. But thanks for the pointer. I tend to not use LCSC. These days, even they don't have much in stock. >
using two chips in a package with lots of pin compatible alternatives might be a good strategy there days