diff --git a/docs/SENSOR_NODE_PROTOCOL.md b/docs/SENSOR_NODE_PROTOCOL.md index 3e0d05e..f76036f 100644 --- a/docs/SENSOR_NODE_PROTOCOL.md +++ b/docs/SENSOR_NODE_PROTOCOL.md @@ -2,7 +2,7 @@ The XIAO sensor node reads the BNO086 and MAX-M10S and publishes vehicle telemetry over half-duplex RS485 at 115200 8-N-1, one JSON object per line at 4 Hz. It owns no control state. Cargo remains the controller, HTTP server, and `/api/v1` source of truth; JBD/NimBLE behavior is unchanged. -The expansion-board pins are D2 driver enable, D4 RX, and D5 TX, matching Seeed's XIAO RS485 expansion-board wiring. Only physical bus ends should be terminated. Confirm A/B polarity because vendor labels vary. +The expansion-board pins are D2 driver enable, D4 TX, and D5 RX. This matches Seeed's working example call `begin(115200, SERIAL_8N1, 7, 6)`: on XIAO, GPIO7 is D5/RX and GPIO6 is D4/TX. Only physical bus ends should be terminated. Confirm A/B polarity because vendor labels vary. ## Schema version 1 diff --git a/firmware/xiao-esp32c6-sensor-node/README.md b/firmware/xiao-esp32c6-sensor-node/README.md index 658caf1..b4079fe 100644 --- a/firmware/xiao-esp32c6-sensor-node/README.md +++ b/firmware/xiao-esp32c6-sensor-node/README.md @@ -4,7 +4,7 @@ This Arduino sketch reads a BNO086 IMU and MAX-M10S GPS and publishes versioned, | Function | XIAO pin | | --- | --- | -| RS485 DE / RX / TX | D2 / D4 / D5 | +| RS485 DE / TX / RX | D2 / D4 / D5 | | BNO086 SDA / SCL | D7 / D8 | | GPS TX to XIAO RX | D9 | | GPS RX from XIAO TX | D10 | diff --git a/firmware/xiao-esp32c6-sensor-node/sensor_node_config.h b/firmware/xiao-esp32c6-sensor-node/sensor_node_config.h index 80041bc..634fb1f 100644 --- a/firmware/xiao-esp32c6-sensor-node/sensor_node_config.h +++ b/firmware/xiao-esp32c6-sensor-node/sensor_node_config.h @@ -2,11 +2,11 @@ #include #define SENSOR_NODE_NAME "xiao_c6_sensor_node" -#define SENSOR_NODE_FIRMWARE_VERSION "0.2.1" +#define SENSOR_NODE_FIRMWARE_VERSION "0.2.2" #define SENSOR_NODE_SCHEMA_VERSION 1 #define RS485_DE_PIN D2 -#define RS485_RX_PIN D4 -#define RS485_TX_PIN D5 +#define RS485_TX_PIN D4 +#define RS485_RX_PIN D5 #define BNO086_SDA_PIN D7 #define BNO086_SCL_PIN D8 #define GPS_RX_PIN D9 diff --git a/tests/test_xiao_sensor_node_contract.py b/tests/test_xiao_sensor_node_contract.py index a6f27b5..d1c226a 100644 --- a/tests/test_xiao_sensor_node_contract.py +++ b/tests/test_xiao_sensor_node_contract.py @@ -7,7 +7,7 @@ def source(name): return (NODE / name).read_text() def test_wiring_matches_assembly(): config = source("sensor_node_config.h") - expected = {"RS485_DE_PIN":"D2", "RS485_RX_PIN":"D4", "RS485_TX_PIN":"D5", + expected = {"RS485_DE_PIN":"D2", "RS485_TX_PIN":"D4", "RS485_RX_PIN":"D5", "BNO086_SDA_PIN":"D7", "BNO086_SCL_PIN":"D8", "GPS_RX_PIN":"D9", "GPS_TX_PIN":"D10"} for name, pin in expected.items(): assert re.search(rf"#define\s+{name}\s+{pin}\b", config)