[TWAI] bus-off error is never reached when using transmit_async (#2421)
* cancel pending tx request when error is from tx * fix format error * update CHANGELOG.md
This commit is contained in:
parent
05a1ebead3
commit
9d4b8fdbc6
@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Fix conflict between `RtcClock::get_xtal_freq` and `Rtc::disable_rom_message_printing` (#2360)
|
||||
- Fixed an issue where interrupts enabled before `esp_hal::init` were disabled. This issue caused the executor created by `#[esp_hal_embassy::main]` to behave incorrectly in multi-core applications. (#2377)
|
||||
- Fixed `TWAI::transmit_async`: bus-off state is not reached when CANH and CANL are shorted. (#2421)
|
||||
|
||||
### Removed
|
||||
|
||||
|
||||
@ -1943,6 +1943,22 @@ mod asynch {
|
||||
}
|
||||
|
||||
if intr_status.bits() & 0b11111100 > 0 {
|
||||
let err_capture = register_block.err_code_cap().read();
|
||||
let status = register_block.status().read();
|
||||
|
||||
// Read error code direction (transmitting or receiving)
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(any(esp32, esp32c3, esp32s2, esp32s3))] {
|
||||
let ecc_direction = err_capture.ecc_direction().bit_is_set();
|
||||
} else {
|
||||
let ecc_direction = err_capture.err_capture_code_direction().bit_is_set();
|
||||
}
|
||||
}
|
||||
// If the error comes from Tx and Tx request is pending
|
||||
if !ecc_direction && !status.tx_buf_st().bit_is_set() {
|
||||
// Cancel a pending transmission request
|
||||
register_block.cmd().write(|w| w.abort_tx().set_bit());
|
||||
}
|
||||
async_state.err_waker.wake();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user