Merge pull request #3468 from korken89/fix-can-hang

This fixes 2 issues where STM32 BXCAN would hang
This commit is contained in:
Dario Nieuwenhuis 2024-10-27 18:19:56 +00:00 committed by GitHub
commit f0a2616dd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -893,7 +893,7 @@ impl RxMode {
RxFifo::Fifo0 => 0usize, RxFifo::Fifo0 => 0usize,
RxFifo::Fifo1 => 1usize, RxFifo::Fifo1 => 1usize,
}; };
T::regs().ier().write(|w| { T::regs().ier().modify(|w| {
w.set_fmpie(fifo_idx, false); w.set_fmpie(fifo_idx, false);
}); });
waker.wake(); waker.wake();
@ -936,18 +936,22 @@ impl RxMode {
Self::NonBuffered(_) => { Self::NonBuffered(_) => {
let registers = &info.regs; let registers = &info.regs;
if let Some(msg) = registers.receive_fifo(RxFifo::Fifo0) { if let Some(msg) = registers.receive_fifo(RxFifo::Fifo0) {
registers.0.ier().write(|w| { registers.0.ier().modify(|w| {
w.set_fmpie(0, true); w.set_fmpie(0, true);
}); });
Ok(msg) Ok(msg)
} else if let Some(msg) = registers.receive_fifo(RxFifo::Fifo1) { } else if let Some(msg) = registers.receive_fifo(RxFifo::Fifo1) {
registers.0.ier().write(|w| { registers.0.ier().modify(|w| {
w.set_fmpie(1, true); w.set_fmpie(1, true);
}); });
Ok(msg) Ok(msg)
} else if let Some(err) = registers.curr_error() { } else if let Some(err) = registers.curr_error() {
Err(TryReadError::BusError(err)) Err(TryReadError::BusError(err))
} else { } else {
registers.0.ier().modify(|w| {
w.set_fmpie(0, true);
w.set_fmpie(1, true);
});
Err(TryReadError::Empty) Err(TryReadError::Empty)
} }
} }