AnsweredAssumed Answered

FlexCAN noob requiring basics

Question asked by lintonsamueldawson on Sep 19, 2012
Latest reply on Oct 4, 2012 by Martin Latal

Hi all,

 

New subscriber here. My company is using MQX for the first time in their new product. Lucky me gets to write the CAN module that communicates with the periphery.

Trying hard to reconcile the documentation with the example FlexCAN code and how this can be adapted to our problem, but having a hard time.

 

I wish to understand more about these mailboxes. It seems you cannot escape them.

Each time I want to send a message (FLEXCAN_Tx_message()) I need a mailbox and identifier.

 

Q1: do I create a separate mailbox for each different CAN message I wish to send or do I re-initialize the same mailbox with every send request?

Q2: is there a limit on the number of mailboxes?

Q3: what *is* the identifier? Is it the CAN message id?

 

On Q3: Documentation hints towards "message buffer ID to use". Isn't the buffer the same as the mailbox? If so, why would I need to provide both mailbox and buffer ID?

 

Then on the receiving side:

I seem to recall reading somewhere that a mailbox can only retain one message.

Our solution will be making CAN broadcasts (bonjour style discovery of periphery) and as such may expect {n} replies of the same ID (the "I am here" reply)

Obviously, the mailbox filter criteria would result in all these replies spamming the one Rx mailbox.

 

Q4: What is the best approach to prevent loss of valuable replies?

We considered the installation of an ISR on one single Rx mailbox and inside this ISR copy received messages out of mailbox and empty out the mailbox in time for subsequent replies.

 

I am sure I will have other questions, but if I got these answered then that will help me on my way a great deal.

Outcomes