Wire Tap

UART Packet Parser in C Exercise

Task

The bench streams frames into USART1 RX for as long as the board runs. Answer each with one line. If its check byte matches -> ACK: and its payload in uppercase hex. If not -> NAK. The registers and bit fields are on the Datasheet tab.

Circuit

Block diagram: TP1 serial console TX into U1 STM32F4 pin PA10 and PA9 back to the console RX, with one frame drawn below as SYNC (always 0xAA), LEN, 1 to 64 payload bytes and a check byte, the check being the XOR of LEN and every payload byte

Pass condition

Each reply ends in \n and must match a correct parser's, in order. Nothing else is sent. Bytes outside any frame get no reply.

Expected replies: two bytes that belong to no frame draw nothing, a frame opening on the sentinel AA whose check byte matches draws one ACK line carrying the payload in uppercase hex, and a frame whose check byte does not draws NAK

Notes

A LEN outside 1 to 64 gets NAK. USART1 runs at 115200 baud, 8N1, BRR = 0x8B. This bench keeps every byte the host sends. A board keeps only one.

Related challenges

Loading the interactive arena.