Search code examples
stm32can-busnucleo

STM32F103RB BxCAN Communication


I'm working on STM32F103RB Nucleo Board. I want to know how CAN messages are segregated in FIFO upon reception of data?. And what happens after FIFO is full(more than 3 messages)?.


Solution

  • When you configure a filter bank, you also specify the receive mailbox (you have 2 of them). Messages which are accepted by one filter bank goes into the associated mailbox.

    FIFO (mailbox) overrun can trigger an interrupt if enabled. The behavior of the FIFO and the fate of the incoming messages are determined by the RFLM bit of the CAN->MCR register.

    1. RFLM = 0 -> The last (3rd) message is overwritten (destroyed) by the new arriving messages. The first (oldest) 2 messages are preserved until you read them.
    2. RFLM = 1 -> FIFO is locked. New arriving messages are discarded. The oldest 3 messages are preserved.