As we know, RS485 physical layer is half-duplex, even if there are only two nodes on the bus, such as a PC and a device, the device can not take the initiative to send data to the PC, because it may conflict with the data sent by the PC.
This is the main reason why RS232 can never be replaced by RS485. In addition to not being able to full-duplex, other aspects of RS485 are much better than RS232, such as longer distances, higher speeds, can be connected to more nodes, more anti-interference.
However, it is now possible to virtualize a full-duplex line between any two nodes on a half-duplex RS485 bus with this small chip.
For example, if there are four nodes A, B, C and D on the bus, A and B can send data to each other at will, and C and D (or A and C) can do the same, and there will be no data conflict.
It also supports multicast communication: A sends data to C and D at the same time, and supports broadcasting: for example, A sends data to B C D at the same time, and then B C D can reply to A at the same time.

The principle of the chip is actually very simple, it is a SPI to UART controller, the UART side has a fixed packet format (original address, destination address, data length of a total of 3 bytes frame header + user data + 2 bytes CRC tail), the chip's UART port can be connected to the RS485 interface chip to control the RS485 send and receive, SPI port is connected to the user MCU.

This UART controller introduces the arbitration function of the CAN bus, except that the sending and receiving follows the standard serial 8N1 format (one start bit, eight data bits, one stop bit, no parity bit).
When transmitting on RS485, arbitration is performed by the first byte of the packet header (the first byte is the sender's address), and non-destructive arbitration is performed by bitwise readback, so that the node with the highest priority has first priority to use the bus, and the node with a low priority, the data will be retransmitted later automatically.
When sending the first byte, RS485 is half-drive output, because there is a delay in readback, the rate is recommended not to exceed 1Mbps.
Since RS485 supports full-drive output (push-pull), so from the second byte, you can use a higher transmission rate, the rate of this chip can reach 50Mbps (similar to the CAN FD dual-rate, but due to the high speed part of CAN FD is still half-drive output, so the rate is restricted).
When using the arbitration mode, you need to keep the rate of the high speed part and the low speed part the same when you need to be compatible with the traditional serial port.
The chip also supports another mode, which can use high speed baud rate throughout the whole process, and can also use RS485 as full duplex - Break Sync mode.
The principle is not complicated, after the bus has been idle for some time, if a node wants to send data, it needs to send a break character (a special serial character with 10 consecutive bit 0's) first.
The function of the break character is to bring the bus out of the idle state, and if more than one node sends a break character at the same time, there will be no harmful impact.
After waiting for the bus to become idle again, each node waits a different amount of time to send data, with higher priority nodes waiting a shorter amount of time. Since each node waits for a different time, no data conflict occurs.
This mode is suitable for buses with a relatively small number of nodes; with a larger number of nodes, the maximum waiting time becomes longer, reducing efficiency.
In addition to the above two peer-to-peer communication modes, it also supports traditional full-duplex and traditional half-duplex modes, and can be used as an ordinary serial expansion chip.
Chip source code and details:
https://cdbus.org The CDBUS IP core is free for FPGA users.
Datasheet: attached below.
Related open source projects:
Semi-automatic desktop SMT machine CDPNP:
https://github.com/dukelec/cdpnphttps://www.eevblog.com/forum/manufacture/(cdpnp)-tiny-open-source-pnp-machine-upgrade-nozzle-and-chip-auto-calibration/CDFOC brushless motor FOC controller :
https://github.com/dukelec/cdfocCDSTEP stepper motor controller :
https://github.com/dukelec/cdstepCDCAM Serial Camera:
https://github.com/dukelec/cdcamCDBUS-BRIDGE (USB to high speed RS485 converter):
https://github.com/dukelec/cdbus_bridgeCDBUS-GUI open source serial software, supports parameter configuration, waveform display, IAP upgrade:
https://github.com/dukelec/cdbus_gui