RS-232: Single-ended, point-to-point serial. Voltage levels ±3V to ±15V. Max distance ~15m at 9600 baud. Used in legacy debug interfaces.
RS-485: Differential signaling. Up to 32 nodes on one bus, up to 1200m distance, up to 10 Mbps. Used in industrial Modbus networks, building automation, DMX lighting.
// RS-485: both TX and RX share same 2 wires (A/B)
// Direction control via DE/RE pin
HAL_GPIO_WritePin(DE_GPIO, DE_PIN, GPIO_PIN_SET); // Enable TX
HAL_UART_Transmit(&huart1, data, len, 100);
HAL_GPIO_WritePin(DE_GPIO, DE_PIN, GPIO_PIN_RESET); // Enable RX