Skip to content

Commit

Permalink
fix(stm32): disable transmitter during half-duplex read
Browse files Browse the repository at this point in the history
  • Loading branch information
badrbouslikhin committed Aug 30, 2024
1 parent f0a8607 commit f6d92b7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions embassy-stm32/src/usart/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,12 @@ fn blocking_flush(info: &Info) -> Result<(), Error> {
let r = info.regs;
while !sr(r).read().tc() {}

// Enable Receiver after transmission complete for Half-Duplex mode
// Disable Transmitter and enable receiver after transmission complete for Half-Duplex mode
if r.cr3().read().hdsel() {
r.cr1().modify(|reg| reg.set_re(true));
r.cr1().modify(|reg| {
reg.set_te(false);
reg.set_re(true);
});
}

Ok(())
Expand Down

0 comments on commit f6d92b7

Please sign in to comment.