S
S
Sergey Kordubin2015-05-22 03:19:11
Microcontrollers
Sergey Kordubin, 2015-05-22 03:19:11

Are there examples of MK matching via RS-485, where there are more than two devices on the bus?

Are there examples of MK matching via RS-485, where there are more than two devices on the bus?
I want to see how normal people organize the reception and sending of data via RS-485, where there are more than two devices on the bus (at least two).
I would like to do it without a slave, just one device sends a message, and the other two listen to it, if one of the two understands that this is a message to him, then he receives and processes it, and then sends a response. It is supposed to use a two-wire (one pair) circuit, and the absence of a leader.
Please help, google search did not help.
Clarification: RS-485 itself is a serial bus. And I would like to use it as a parallel one!
Circuitry issues are interesting only in the matter of one or two pairs, and a large length of wires. (I can find advice on wiring, load, capacitance and others myself).
In general, I would use i2c (I have no more than 15 meters), but the need to interrogate all receivers from the slave (in my case 20) is already tin. Tin because an interrupt will be triggered on the data transmission, and then my receivers will parse the line 50% of the time, or then the slave will not know for a long time what is going on with the slave.
Yes, PCs and I2S are good for what they are created for, but I need a peer-to-peer local network (star) when, when changing on one device, it itself went on the air and announced the change.
I’ll already think about two wired UART, take it and parallelize, if necessary, the device, read the line, and if someone’s data is being transmitted, then it waits for a random time, if there is no transmission, then it sent an uncommon eight-bit byte on the air, and all the rest received it and parsed it and, based on this command, took or did not take actions.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Makarov, 2015-05-22
@DmitryITWorksMakarov

As far as I remember, there are three lines in the RS-485 standard: A, B and 0 (plus, in especially neglected cases, a screen). Otherwise, the potential of lines A and B will run far beyond the power supply limits, the receiver will go into saturation and will not work correctly, and as a maximum it can fail. Although of course it all depends on the electromagnetic environment and the length of the line.
It is not clear what agreement is of interest.
If physical, then between A and B it is necessary to put 100 Ohm 0.25 W terminal resistors at the farthest points of the line.
Plus, it is necessary to provide the initial offset of the lines by pulling B through the resistor to the power supply, and A through the resistors to zero in one place of the line. The default line should be in a state where Ub > Ua.
As for logical agreement, about interaction without a follower. The rs485 standard does not define this, but you can do the usual collision resolution. Send a message and read it yourself. If it arrived, then what was sent, then at that moment no one was transmitting anything and the package was sent successfully. If the received differs from the transmitted, then there is a collision (two transmitters transmitted at the same time). You wait for a random time less than T and repeat the transmission. T - configurable, depends on the activity of interaction and the number of subscribers.

L
LampTester, 2015-06-11
@LampTester

To begin with, RS-485 is only a physical layer requirement. At the byte transfer level, this is most often the UART.
Further, it seems to me that you are confused about the concepts of master-slave and serial-parallel bus. RS-485 is a serial bus, but nothing prevents you from using the star topology, which, as I understand it, you need. If one device transmits and the rest receive, then it is the master, and the rest are slaves.
I made a similar system that works via RS-485. So I took the RS-485 level converters and connected them to the UART. The protocol was self-written, batch, with one master and a bunch (according to requirements up to 200+) slaves. In this version, everything works. Once again, RS-485 is not the same as Profibus, Modbus and other protocols - they work on top of it.

P
Papayaved, 2018-04-14
@Papayaved

I'm afraid the bus on RS-485 will not work without a controller. For a common bus, you need to use a transformer like in Ethernet, special driver chips like CAN or an open collector - then there will be no physical conflicts on the bus and nothing will burn. But you need to have a mechanism for handling collisions - when several devices want to enter the bus at the same time.
Coordination is required at the ends of the lines - two terminators (resistors) of 120 ohms. All devices must be connected in series and not in a star.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question