f41661eb7dcf518ac183ba2579f0a7e9765d41f7
CH32-16-CH-EXT
A simple CH32V003-based extension board providing 16 GPIO channels, primarily designed for controlling Chinese 16-relay modules (archive) over RS485. Uses 64-byte internal flash page for state persistence.
KiCad hardware design files are in the hw directory.
Communication Protocol
Message Format
The RS485 communication uses a simple 4-byte message format:
Byte 0: Board Address (0x01-0xFE, 0xFF for broadcast)
Byte 1: Command (0x01 for SET_OUTPUTS)
Byte 2: Data High Byte
Byte 3: Data Low Byte
Protocol Constants
#define BOARD_ADDRESS 0x01 // Default board address
#define CMD_SET_OUTPUTS 0x01 // Command to set outputs
#define BROADCAST_ADDR 0xFF // Broadcast address
Example Message
To control the outputs, send a 4-byte message:
let message = [
address, // Board address (0xFF for broadcast)
CMD_SET_OUTPUTS, // Command
(value >> 8) as u8, // Data high byte
value as u8, // Data low byte
];
Description
Languages
C
98.2%
Makefile
1.8%

