This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 16d501d7411b8d7a6d9e8e76d3f725d90ff87c16
Author: Jacob Dahl <[email protected]>
AuthorDate: Tue Aug 25 18:59:49 2026 -0600

    arch/arm/src/imxrt: Assign FlexCAN MAXMB rather than OR-ing it in.
    
    MAXMB resets to 0x0f, so OR-ing the intended value into MCR can only ever
    raise it. Every configuration with fewer than 16 mailboxes therefore runs 
with
    MAXMB = 15 and FlexCAN arbitrates over mailboxes the driver never 
initialised:
    with the classic payload layout MB14 and MB15 hold power-on contents, and 
with
    a 64-byte CAN FD layout they are past the end of the mailbox RAM region
    entirely.
    
    s32k1xx_flexcan.c already does this; carry the same two lines over.
    
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Jacob Dahl <[email protected]>
---
 arch/arm/src/imxrt/imxrt_flexcan.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/src/imxrt/imxrt_flexcan.c 
b/arch/arm/src/imxrt/imxrt_flexcan.c
index d10bbedf174..ea98ed0c605 100644
--- a/arch/arm/src/imxrt/imxrt_flexcan.c
+++ b/arch/arm/src/imxrt/imxrt_flexcan.c
@@ -1916,6 +1916,9 @@ static void imxrt_reset(struct imxrt_driver_s *priv)
     }
 
   regval  = getreg32(priv->base + IMXRT_CAN_MCR_OFFSET);
+  regval &= ~CAN_MCR_MAXMB_MASK; /* Zero MAXMB to ensure "bitwise or"
+                                  * below sets the correct value.
+                                  */
   regval |= CAN_MCR_SLFWAK | CAN_MCR_WRNEN | CAN_MCR_SRXDIS |
             CAN_MCR_IRMQ | CAN_MCR_AEN |
             (((TOTALMBCOUNT - 1) << CAN_MCR_MAXMB_SHIFT) &

Reply via email to