Skip to content

Commit ff3b9d0

Browse files
committed
usart: add better comments with TRM refs
1 parent f34b4f5 commit ff3b9d0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

port/wch/ch32v/src/hals/usart.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ pub const USART = enum(u2) {
209209
}
210210

211211
/// Check for errors and return them
212+
/// TRM 18.10.1 (USARTx_STATR): PE/FE/NE (and IDLE) are cleared by reading the status register
213+
/// then reading the data register. ORE is also cleared by the SR→DR read sequence. Note the TRM
214+
/// caveat for PE:
215+
/// > Before this bit is cleared, the software must wait for RXNE to be set.
216+
/// Our call sites only invoke check_errors() after RXNE is set.
212217
fn check_errors(usart: USART) ReceiveError!void {
213218
const regs = usart.get_regs();
214219
const status = regs.STATR.read();

0 commit comments

Comments
 (0)