SANPO USB to RS485
SANPO USB to RS485 lets a PC select one of RS485-1/2/3/4. The host places a raw device command inside an RT wrapper. The board only selects the interface and forwards the data; it does not change the motor protocol.
To send unwrapped data without a Channel field, use RS485 Raw Passthrough. Raw passthrough requires at least 3 ms of idle time between commands; use the RT wrapper on this page for continuous high-rate real-time control.
Connection and Communication Settings
A complete board normally exposes two USB serial ports. One accesses RS485-1/2, and the other accesses RS485-3/4. For first use, connect one device to identify the USB-to-interface mapping.
Factory defaults are 4 Mbps, one stop bit, no parity, and eight data bits. Send AT+SETRS485? before use and change the settings through Communication Settings when necessary. The bitrate selected in a USB serial application does not change the RS485 bus.
Select an RS485 Channel
Current USB port |
Channel |
Target |
|---|---|---|
Port for RS485-1/2 |
|
RS485-1 |
Port for RS485-1/2 |
|
RS485-2 |
Port for RS485-3/4 |
|
RS485-3 |
Port for RS485-3/4 |
|
RS485-4 |
Either USB port |
|
Both RS485 interfaces on the current MCU |
For transmission, 1/3 select the first local interface and 2/4 select the second. Replies use local Channel: 0x01 for the first and 0x02 for the second.
RT Frame Format
Transmit and receive use the same wrapper:
Field |
Length |
Description |
|---|---|---|
Header |
2 bytes |
Fixed |
Channel |
1 byte |
RS485 interface number |
Data length |
1 byte |
Raw RS485 data length, up to 64 bytes |
Data |
0 to 64 bytes |
Raw command or feedback defined by the device manufacturer |
Tail |
2 bytes |
Fixed |
When transmitting to RS485, the board removes RT, Channel, length, and tail and sends only the raw Data field. When a device replies, the board adds an RT wrapper and sets Channel to the first or second local interface.
Unitree GO-M8010 Example
Raw Unitree command:
FE EE 11 00 00 00 00 00 00 00 00 00 00 00 00 18 7C
Wrap the 17 bytes for Channel 2:
52 54 02 11 FE EE 11 00 00 00 00 00 00 00 00 00 00 00 00 18 7C 0D 0A
02 is the target and 11 is hexadecimal for 17. The RS485 bus still carries only the 17 raw bytes beginning with FE EE.
A motor reply has a form similar to:
52 54 02 10 FD EE ...16 bytes of motor feedback... 0D 0A
Example: USB to RS485 Unitree motor
Windows:
python usb2rs485_unitree_demo_v6.py --port COM9 --motors 1 --channel 2
Linux:
sudo python3 usb2rs485_unitree_demo_v6.py --port /dev/ttyACM0 --motors 1 --channel 2
Troubleshooting
Symptom |
Action |
|---|---|
Command is sent on both RS485 interfaces |
Channel is |
No feedback |
Check USB mapping, Channel, RS485 settings, device ID, command checksum, A/B wiring, and power |
Reply Channel shows 1/2 instead of 3/4 |
Replies use local numbering; this is normal |
Reply does not begin with |
RAW replies are enabled; send |
Need to send raw RS485 data directly |
Enable RAW replies as described in RS485 Raw Passthrough |
Reply is split into several blocks |
Reassemble the |