cancel
Showing results for 
Search instead for 
Did you mean: 

Atomicity/ Data Consistency in reading output mailbox of bxCAN

ellis
Associate

 

In fact I have several questions about reception handling of bxCAN and one of them is demonstrated in the title.   I will show my questions by an example. ( All the following discussion is based on Section 32.7.3 in  STM32F405/415, STM32F407/417, STM32F427/437 and STM32F429/439 advanced Arm<Sup>®</Sup>-based 32-bit MCUs - Reference manual ).

The development tools I have are limited, preventing me from conducting experiments to verify these issues by myself. It will be helpful if ST's technical staff can assist in answering my questions, as these details are not included in the reference manual.

Suppose 4 CAN data frames arrived and they were all stored into FIFO1. Then CPU wrote 1 to RFOM1 for 4 times. This procedure is showed in figure1.

 

figure1.png

                          

 

 

figure 1

 

We focus on 7 specific moments t0, t1, t2, t3, t4, t5t6.

We assume that in t0 the FIFO1 is empty, i.e, FMP1[1:0] in CAN_RF1R is 00b. And FIFO lock function is disabled.

I hope someone could confirm whether the following statements are true.

1.The mailbox and 3-level FIFO(Only FIFO1 is used and FIFO0 is excluded in our discussion.) can store up to four different data frames.

2.At t1, FMP1[1:0] in CAN_RF1R is 11b.    FULL1 is 1.

The message distribution should seem like figure2.

 

figure2.png

 

figure 2

3. At t2, FMP1[1:0] in CAN_RF1R is 11b.    FULL1 is 1.

The message distribution should seem like figure3.

 

figure3.png

 

figure 3

 4.After t3, FMP1[1:0] in CAN_RF1R is 11b.     FULL1 is 1.

The message distribution should seem like figure4.

 

figure4.png

 

figure 4

 5.After t4, FMP1[1:0] in CAN_RF1R is 10b.     FULL1 is 0.

The message distribution should seem like figure5.

 

 

 figure5.png

figure 5

6.After t5, FMP1[1:0] in CAN_RF1R is 01b.     FULL1 is 0.

The message distribution should seem like figure6.

 

 

 figure6.png

figure 6

7.After t6, FMP1[1:0] in CAN_RF1R is 00b.     FULL1 is 0.

The message distribution should seem like figure7.

 

figure7.png

 

figure 7

8.Atomicity/ Data Consistency of output mailbox is guaranteed. Though the RX FIFO may be over written by new data frames(if FIFO lock is disabled).

9.Final question.  The description of RFOM1 in rm0090 reads:

If at least two messages are pending in the FIFO, the software has to release the output mailbox to access the next message.

Cleared by hardware when the output mailbox has been released.

It seems to me that after writing 1 to RFOM1 output mailbox will be released by hardware, and the pending data in FIFO is being copied into output mailbox while RFOM1 remains 1.  here comes my question:

                   --- Is the data consistency guaranteed when RFOM1 remains 1? (I believe there must be a period during which it isn’t since memory WR can’t be done instantly)? 

                  ---Should I read back RFOM1 and wait until it becomes 0 before reading the next message in output mailbox?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Douglas MILLER
ST Employee

This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.

View solution in original post

1 REPLY 1
Douglas MILLER
ST Employee

This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.