Maker Pro
Maker Pro

How can I design a multidrop connection for TTL serial communication?

jkcobain

Apr 7, 2016
5
Joined
Apr 7, 2016
Messages
5
Hello everyone,

I need to connect two Tx terminals to one master (with Rx I have no problems). My problem is that I want (need) to avoid the slaves to receive the voltage in their respective Tx terminals when they aren't transmitting. I first thought of diodes, but they don't work, because they get active above a certain voltage, so that I lose the low bits.

So how can I do that? Or isn't it that bad to connect two Tx together (of MAX232, either from TTL or to RS232 serial port) without a protection? or maybe resistances to limit the current would be enough?

Hope you can help. Thank you in advance!

(additional details: Everything is designed in a way that no devices transmit at the same time. There is one master and two slaves. The slaves never talk to each other. I DON'T want to use RS485, because I've been unable to control the transmit/receive bit)
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,723
Joined
Nov 17, 2011
Messages
13,723
TTL or RS232 are not intended to be used in multi-sender applications.
However, you can use TTL over short distances using Tri-state buffers to create a bus system. You really have to ensure that no two drivers are active at the same time.
Another method (which I really do not recommend for noisy environments or for long distances) is wired-or. You use a single pull-up resistor on the commmunication line plus one pull-down transistor on each sender. An inactive sender turns the pull-down transistor off. An active sender turns the transistor on and off to transmit the bit stream over the connection. On the receiving end a Schmitt-trigger input is recommended to improve noise immunity. Note that due to the RC time constant of the pull-up resistor and the ever present capacitnaces this method is rathe slow, limiting bit rate severly on longer lines.


For noisy environments RS485 is the preferred signalling method. I don't understand this part:
I've been unable to control the transmit/receive bit
You can set up separate lines for transmitting from teh slaves to the master or from teh master to the slaves, so there is no need to control transmit/receive direction (although that isn't too difficult either). Even when using RS485 you have to ensure that inactive senders are tri-state.
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
What you need is a multi-master or "multi point interface".
You need to define the working speed and distance that the connection requires.

Apart from the RS485 that Harald suggested.
You can use I2C ,SPI and even Ethernet or wifi.
All of them require a protocol.
 

jkcobain

Apr 7, 2016
5
Joined
Apr 7, 2016
Messages
5
TTL or RS232 are not intended to be used in multi-sender applications.
However, you can use TTL over short distances using Tri-state buffers to create a bus system. You really have to ensure that no two drivers are active at the same time.
Another method (which I really do not recommend for noisy environments or for long distances) is wired-or. You use a single pull-up resistor on the commmunication line plus one pull-down transistor on each sender. An inactive sender turns the pull-down transistor off. An active sender turns the transistor on and off to transmit the bit stream over the connection. On the receiving end a Schmitt-trigger input is recommended to improve noise immunity. Note that due to the RC time constant of the pull-up resistor and the ever present capacitnaces this method is rathe slow, limiting bit rate severly on longer lines.


For noisy environments RS485 is the preferred signalling method. I don't understand this part:

You can set up separate lines for transmitting from teh slaves to the master or from teh master to the slaves, so there is no need to control transmit/receive direction (although that isn't too difficult either). Even when using RS485 you have to ensure that inactive senders are tri-state.

If I need to use tri-state buffers, then I still have the same problem: to control the third state of the buffer. And my problem is that I can't control a bit to tell the devices whether they should transmit or receive. I tried with visual basic, but my bit (both RTS or DTR) goes low before transmition is finished, and I've been unable to find a solution. I could also control with a bit in my PIC, but I'm guessing I would have the same problem, since I don't know how to tell when transmition is finished.

In vb.net I tried using the property BytesToWrite, to tell whether there are bytes left to send, but it ALWAYS returns zero, as if it never had bytes left to write. In the PIC I have no idea on how to verify whether the transmition is finished.

Any suggestion? I'm desperate, it's been about two weeks since trying to communicate using RS485, but I can't find a solution :(
(And if you're wondering, YES, I'm a noob)
 

jkcobain

Apr 7, 2016
5
Joined
Apr 7, 2016
Messages
5
What you need is a multi-master or "multi point interface".
You need to define the working speed and distance that the connection requires.

Apart from the RS485 that Harald suggested.
You can use I2C ,SPI and even Ethernet or wifi.
All of them require a protocol.
Ok, thanks
 

jkcobain

Apr 7, 2016
5
Joined
Apr 7, 2016
Messages
5
I could finally get it working. I controlled by using the "ENABLE" option from #USE RS232 on CCS. Thank you for your answers guys.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,723
Joined
Nov 17, 2011
Messages
13,723
I don't know how to tell when transmition is finished.
How can you then ensure that no 2 senders will be active at the same time?

In the PIC I have no idea on how to verify whether the transmition is finished.
I don't know the detailed operation of pics, but typically a UART has a status register which can be polled. This status register should contain a bit which tells you whether transmission is finished. Or the UART may even be able to signal the end of a transfer by issuing an interrupt?
Read this document to learn about PIV UART modes. It tells you that there is a hardware flow control unit. This is in my opinion exactly what you need The RTS signal (Request To Send) becomes active when a byte needs to be sent out by the UART. It needs to be confirmed by CTS (Clear To Send). Simply connect RTS to CTS to enable automatic sending whenever a byte is in the UARTt buffer. Use RTS also to control the tristate pin of your transmitter (RS485 or TTL, it doesn't matter).


Over which distance do you need to transmit?
What is your bitrate?
 

jkcobain

Apr 7, 2016
5
Joined
Apr 7, 2016
Messages
5
How can you then ensure that no 2 senders will be active at the same time?

I think it is not the same. I'm sure about that because I first request data with the master (PC), and only then either the PIC or a scale responds. But if I set a bit, then send through serial port, then unset the bit, the bit goes low before transmition is finished. Well... as I said befor, that is solved by using the "ENABLE" pin on the PIC.

Over which distance do you need to transmit?
What is your bitrate?

Not more than 5m, my baud is 9600. Not really much. I only need RS485 because I need multipoint communication.
 

Herschel Peeler

Feb 21, 2016
401
Joined
Feb 21, 2016
Messages
401
Hello everyone,

I need to connect two Tx terminals to one master (with Rx I have no problems). My problem is that I want (need) to avoid the slaves to receive the voltage in their respective Tx terminals when they aren't transmitting. I first thought of diodes, but they don't work, because they get active above a certain voltage, so that I lose the low bits.

So how can I do that? Or isn't it that bad to connect two Tx together (of MAX232, either from TTL or to RS232 serial port) without a protection? or maybe resistances to limit the current would be enough?

Hope you can help. Thank you in advance!

(additional details: Everything is designed in a way that no devices transmit at the same time. There is one master and two slaves. The slaves never talk to each other. I DON'T want to use RS485, because I've been unable to control the transmit/receive bit)


Other consideration ... synchronous or asynchronous?
How many lines?
One Data line or two (Data In, Data Out)
Strobe?
Reset?
Sync?
Address?
Some standard interface like I2C?
 
Last edited:
Top