Skip to content

UART Protocol

Roman Kuraev edited this page Jul 10, 2026 · 2 revisions

F103 ↔ EMW3165 UART Protocol

The original F103 sensor/display controller communicates with the EMW3165's STM32F411 over USART2 at 115200 8N1. Rewair keeps this interface so the stock sensor and display firmware remain in service.

Frame format

*CMDLLLLLLLL\0field\0value\0...#
  • CMD is a four-byte ASCII token.
  • LLLLLLLL is the eight-digit uppercase hexadecimal payload length.
  • The payload is a sequence of NUL-separated fields.
  • # terminates the frame.

The receiver validates the header, declared length, and trailer before handing a frame to the bridge.

Commands used by Rewair

Current firmware sends:

Token Purpose
NETW Network state, RSSI, address, and MAC
TINF Timezone and daylight-saving transition data derived from the saved POSIX rule
TIME Current wall-clock time
DISP Display mode
SCOR Calculated score and sensor-index display data

Current firmware handles these incoming frames explicitly:

Token Purpose
SENS Sensor readings used for status, scoring, and MQTT
REDY Sensor-board ready indication
RUNN Running/liveness indication
BTST Boot/self-test state
TEST Test lifecycle state
NETD Network-down request/state
NETR Network-restart request/state

Additional observed vocabulary

The stock firmware contains more tokens than Rewair currently needs. Their names and likely roles are retained here without claiming complete semantics:

  • Display and interaction: SLEP, NOTI, SUND, KNCK, ALRM, TUTO, MESG, LEDS
  • Identity and status: VERS, SCCD, DVID, MACA, SSID, WVER, SVER, WLOG, WSTA
  • Update and control: HASH, UPGR, DOWN, FNOW, FDEF, DEBG, BOOT
  • Test lifecycle: TEND

Some tokens may be bidirectional request/response pairs. Direction and payload meaning should be treated as unknown until observed on the wire or confirmed in the F103 firmware.

Confirmed display experiments

  • DISP mode clock shows the clock.
  • DISP mode default blanked the display on the tested unit.
  • MESG message hello timeout 5 uses message and timeout field names.
  • LEDS color white blink 0 produces a steady white LED.
  • SCOR requires the empty index and sensor separators used by the bridge.

Open questions

  • Which boot-context frames are mandatory before the F103 starts SENS?
  • Whether SCOR is ever emitted spontaneously by the F103.
  • Whether DOWN refers to network state, firmware download state, or both.
  • Which unimplemented tokens are required to clear any F103-side error state.

Clone this wiki locally