Tools for interfacing with DJI ESC RS-485 communication using SAMD21 + MAX485.
- SAMD21 board
- MAX485 module
SAMD21 XIAO MAX485 Module
---------------------------------
D6 (TX) ──────> DI (Driver Input)
D7 (RX) <────── RO (Receiver Output)
D2 ──────> DE + RE (tied together)
3.3V ──────> VCC
GND ──────> GND
MAX485 DJI ESC Connector
---------------------------------
A ──────> A+ (or B+, depending on pair)
B ──────> A- (or B-, corresponding pair)
GND ──────> GND (common ground)
Upload interface.ino to your SAMD21 board:
# Open Arduino IDE
# Select: Tools > Board > SAMD21 board (e.g., "Seeeduino XIAO")
# Select: Tools > Port > /dev/cu.usbmodem... (your device)
# Upload interface.inoInstall dependencies:
pip install pyserialRun the interface:
python3 buslog.py -p /dev/cu.usbmodemXXXX
from interface import RS485Interface, DJIFrame
# Connect to device
iface = RS485Interface()
iface.connect()
# Send ESC telemetry request frame (0xA0D0)
payload = bytes.fromhex('AC 03 AC 03 AC 03 AC 03 AC 03 AC 03 AC 03 AC 03')
frame = DJIFrame(cmd_id=0xA0D0, reserved=0x0000, sequence=0, payload=payload)
iface.send_frame(frame)
# Send Flight Controller query (0xA021)
payload = bytes.fromhex('65 15 07 00 5F 00 00 00 B1 03 00 00 00 00 00 80 29 B0 00 00 00 00 80 3D 00 00')
frame = DJIFrame(cmd_id=0xA021, reserved=0x0001, sequence=0, payload=payload)
iface.send_frame(frame)
# Receive frames
frames = iface.receive(timeout=5.0)
for frame in frames:
print(frame)
# Monitor bus continuously
iface.monitor()
# Cleanup
iface.disconnect()python3 interface.pyCommands:
send <cmd_id> <seq> <payload_hex>- Send DJI framerecv [timeout]- Receive frames for timeout secondsraw <hex_bytes>- Send raw bytesmonitor- Monitor bus indefinitelyquit- Exit
Examples:
>> send 0xA0D0 0 AC03AC03AC03AC03AC03AC03AC03AC03
>> recv 5
>> raw 55 1A 00 D0 A0 00 00 01 AC 03 AC 03 AC 03 AC 03 AC 03 AC 03 AC 03 AC 03 00 00
>> monitor
Converts scope CSV captures to decoded frame CSV:
python3 decode.py input.csv output.csvInput: Scope CSV with UART bytes in "Rx" column Output: CSV with parsed frame fields
Analyzes telemetry values from decoded frames:
python3 analyze_telemetry.py decoded_frames.csvShows voltage, sequence, and identifies frame types.