# ZeMesh Transport MCU <-> App MCU UART Protocol **Version 0.1** — Engineering Specification The ZeMesh Transport MCU and the App MCU exchange opaque payloads over UART. The link is asynchronous and symmetric: both directions use the same frame format. There are no commands, acknowledgements or retransmissions. Delivery control, if needed, is handled by the application layer. UART: 230400, 8N1, no parity, no flow control. ## Frame | 0xFD | Length | Payload (0..255 bytes) | CRC lo | CRC hi | | --- | --- | --- | --- | --- | | 1B | 1B | Length bytes | 1B | 1B | **Length:** payload size in bytes (CRC not included). **CRC:** CRC-A (ISO 14443-3), init 0x6363, no final XOR, calculated over Length + Payload, transmitted low byte first. **Inter-byte timeout:** the pause between two consecutive bytes of one frame must not exceed 1 ms. If the pause is longer, the receiver discards the partially received frame and waits for the next 0xFD. The sender must therefore transmit a frame without gaps. **A frame is dropped silently in two cases:** wrong CRC, or inter-byte timeout. There is no error notification to the sender. ## Optional hardware signals (wired, usage is optional) ### **BUSY** (output of ZeMesh, active low) Low = ZeMesh is busy and cannot accept data. High (released) = ready. ZeMesh pulls BUSY low when it detects the start of a frame from the App MCU and keeps it low while the frame is being received and processed, or while the input queue is full. After the frame has been handed over for transmission, ZeMesh releases BUSY. The App MCU must not start a new frame while BUSY is low. ### **FRAME\_ACTIVE** (output of ZeMesh, active low) Asserted by ZeMesh before the first byte (0xFD) of a frame destined to the App MCU is sent, and released after the last byte (CRC hi) has been sent. The App MCU may use the falling edge as an interrupt/wake-up source and the rising edge as an end-of-frame marker, which allows receiving a frame without relying on the Length field or the inter-byte timeout. ZeMesh does not wait for the App MCU: if the App MCU cannot keep up, the data is lost and is recovered by the application layer. # Annex 1: CRC calculation example void Crc(uint8\_t \*data, size\_t szLen, uint8\_t \*crc) // pointer to data, its length, crc output { uint8\_t bt; uint32\_t wCrc = 0x6363; do { bt = \*data++; bt = (bt ^ (uint8\_t)(wCrc & 0x00FF)); bt = (bt ^ (bt << 4)); wCrc = (wCrc >> 8) ^ ((uint32\_t)bt << 8) ^ ((uint32\_t)bt << 3) ^ ((uint32\_t)bt >> 4); } while (--szLen); \*crc++ = (uint8\_t)(wCrc & 0xFF); \*crc = (uint8\_t)((wCrc >> 8) & 0xFF); }