refactor(driver_twai): remove errata config selection 3

This commit is contained in:
wanckl
2025-11-11 13:18:14 +08:00
parent 08de38ae62
commit 425f7f8053
6 changed files with 24 additions and 17 deletions
@@ -40,6 +40,11 @@
// cycle, the transmit interrupt could be lost.
#define TWAI_LL_HAS_INTR_LOST_ISSUE 1
// When in the listen only mode, the TWAI controller must not influence the TWAI bus (i.e., must not send
// any dominant bits). However, while in listen only mode, the TWAI controller will still transmit dominant
// bits when it detects an error (i.e., as part of an active error frame).
#define TWAI_LL_HAS_LOM_DOM_ISSUE 1
#ifdef __cplusplus
extern "C" {
#endif
@@ -27,6 +27,11 @@
#define TWAI_LL_GET_HW(controller_id) ((controller_id == 0) ? (&TWAI) : NULL)
// When in the listen only mode, the TWAI controller must not influence the TWAI bus (i.e., must not send
// any dominant bits). However, while in listen only mode, the TWAI controller will still transmit dominant
// bits when it detects an error (i.e., as part of an active error frame).
#define TWAI_LL_HAS_LOM_DOM_ISSUE 1
#ifdef __cplusplus
extern "C" {
#endif
@@ -27,6 +27,11 @@
#define TWAI_LL_GET_HW(controller_id) ((controller_id == 0) ? (&TWAI) : NULL)
// When in the listen only mode, the TWAI controller must not influence the TWAI bus (i.e., must not send
// any dominant bits). However, while in listen only mode, the TWAI controller will still transmit dominant
// bits when it detects an error (i.e., as part of an active error frame).
#define TWAI_LL_HAS_LOM_DOM_ISSUE 1
#ifdef __cplusplus
extern "C" {
#endif
@@ -27,6 +27,11 @@
#define TWAI_LL_GET_HW(controller_id) ((controller_id == 0) ? (&TWAI) : NULL)
// When in the listen only mode, the TWAI controller must not influence the TWAI bus (i.e., must not send
// any dominant bits). However, while in listen only mode, the TWAI controller will still transmit dominant
// bits when it detects an error (i.e., as part of an active error frame).
#define TWAI_LL_HAS_LOM_DOM_ISSUE 1
#ifdef __cplusplus
extern "C" {
#endif
+4 -6
View File
@@ -143,12 +143,10 @@ void twai_hal_start(twai_hal_context_t *hal_ctx)
twai_ll_set_mode(hal_ctx->dev, hal_ctx->enable_listen_only, hal_ctx->enable_self_test, hal_ctx->enable_loopback);
//Clear the TEC and REC
twai_ll_set_tec(hal_ctx->dev, 0);
#ifdef CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM
/*
Errata workaround: Prevent transmission of dominant error frame while in listen only mode by setting REC to 128
before exiting reset mode. This forces the controller to be error passive (thus only transmits recessive bits).
The TEC/REC remain frozen in listen only mode thus ensuring we remain error passive.
*/
#if TWAI_LL_HAS_LOM_DOM_ISSUE
// Errata workaround: Prevent transmission of dominant error frame while in listen only mode by setting REC to 128
// before exiting reset mode. This forces the controller to be error passive (thus only transmits recessive bits).
// The TEC/REC remain frozen in listen only mode thus ensuring we remain error passive.
if (hal_ctx->enable_listen_only) {
twai_ll_set_rec(hal_ctx->dev, 128);
} else