From 6983d1e0bb52ecb589462ac0ac1c89b6cbbd4460 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Tue, 4 Aug 2020 19:27:02 +0800 Subject: [PATCH] TWAI: Fix BRP field initialization onf ESP32 ECO3 This commit zero initializes the brp_div field on ESP32 ECO3 to prevent incorrect timing configuration. --- components/soc/src/esp32/include/hal/twai_ll.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/soc/src/esp32/include/hal/twai_ll.h b/components/soc/src/esp32/include/hal/twai_ll.h index 236ddff9d8..5a4422ab74 100644 --- a/components/soc/src/esp32/include/hal/twai_ll.h +++ b/components/soc/src/esp32/include/hal/twai_ll.h @@ -367,6 +367,8 @@ static inline void twai_ll_set_bus_timing(twai_dev_t *hw, uint32_t brp, uint32_t //Need to set brp_div bit hw->interrupt_enable_reg.brp_div = 1; brp /= 2; + } else { + hw->interrupt_enable_reg.brp_div = 0; } #endif hw->bus_timing_0_reg.brp = (brp / 2) - 1;