P
P
piotrosiotr2022-01-14 20:45:42
C++ / C#
piotrosiotr, 2022-01-14 20:45:42

How to implement multiplexing of two data streams between two microcontrollers?

The crux of the matter is this. There are two microcontrollers connected by a half-duplex data link. The first collects them, the second displays them. There was a need to transmit two data streams in parallel. How can this task be optimally implemented so that the data is not confused and there is no desynchronization? Are there any ideas on this, or maybe literature that can be read?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2022-01-14
@piotrosiotr

Option one:
Make one of the CS (Chip Select) signals.
Raise it for one controller, lower it for the second.
Raised - the transfer is received by the first. Omitted - the second.
In theory, CS signals can switch each other or select a specific receiver.
Option two:
Purely software. Use the CD (Carier Detect) signal, it is raised by the transmitting side, everyone else listens to the message. No one can send while the CD is up. In the package, the first byte is the receiver's number. To avoid collisions, it is desirable to define the duration or maximum size of the transmission.
In this version, you can still use an additional signal line INT (Interrupt). It is raised by the one who wants to make an urgent transmission, with the CD raised.
No one picks up a CD Until INT is shot.
CD up, sending in progress
Someone raised INT, Previous send went through, but no one grabs the line via CD.
The one who raised the INT waits for the CD to be released, raises the CD himself, removes the INT, and starts the transmission.
If the INT and CD lines are free, anyone can pick up the CD and start transmission.
References: I2C networks, CAN, RS-485 + modbus, SPI, FrameRelay....

N
Nikolai, 2022-02-03
@Nick495

Good afternoon.
If the controllers are close, then the high-speed SPI protocol is best suited.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question