[USPD] clear interrupt flags right after reception
Clearing the interrupt flags at beginning of reception will masks overruns and cause corrupted packets to be received. Instead clear the flags right after disabling the interrupt/after reception, so overruns on the next receive can be caught. Tested by forcing overruns due to explicit sleeps Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
This commit is contained in:
parent
84cbf1d198
commit
9e8035cfb9
1 changed files with 6 additions and 7 deletions
|
@ -347,15 +347,14 @@ impl<'d, T: Instance> PdPhy<'d, T> {
|
|||
.read(r.rxdr().as_ptr() as *mut u8, buf, TransferOptions::default())
|
||||
};
|
||||
|
||||
// Clear interrupt flags (possibly set from last receive).
|
||||
r.icr().write(|w| {
|
||||
w.set_rxorddetcf(true);
|
||||
w.set_rxovrcf(true);
|
||||
w.set_rxmsgendcf(true);
|
||||
});
|
||||
|
||||
let _on_drop = OnDrop::new(|| {
|
||||
Self::enable_rx_interrupt(false);
|
||||
// Clear interrupt flags
|
||||
r.icr().write(|w| {
|
||||
w.set_rxorddetcf(true);
|
||||
w.set_rxovrcf(true);
|
||||
w.set_rxmsgendcf(true);
|
||||
});
|
||||
});
|
||||
|
||||
poll_fn(|cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue