AnsweredAssumed Answered

Mailboxes and Buffers from flexcan example

Question asked by Jeremy Sanchez on Aug 29, 2009
Latest reply on May 4, 2012 by metin genc

I am trying to use FlexCAN on M52259EVB with the example provided on MQX located at ...\mqx\examples\can\flexcan.

After performing different tests, I figured I need to know the following:

How does the flexcan Buffers work? Are they like a space to store outgoing or incoming messages with an specific ID?
OR
Are they just like: buffer 0 is full so next message goes to buffer 1, if buffer 1 is full then it goes to buffer number 2


Is flexcan receiving its own sent messages, even if LoopBack is disabled?


In the example I already mention, What is call a mailbox ? Is it like a bigger buffer to store multiple messages received/sent with the same identifier OR, is it only the way they call the buffers already implemented into flexcan from the MCU.

In my application 1 master board will be sending and receiving messages to/from 4 slave boards. Therefore, I am trying to define 2 mailboxes (TX and RX) to control each of the slave boards.

In the example provided, there is an installation instruction for different ISR for each mailbox but when I use this function interrupts are not triggered when I send a message with the identifier that corresponds to the mailbox(I am sending messages using canalyzer).

 

I need to clarify the questions above and read check documentation about the code example and flexcan.

 

This is the code I am using to trigger 4 different Interrupts, but it results and triggering only 2 interrupts.

 

 


   GRYPHON_ADDRESS = 1;      RX_Limbic1 = 0;   IdentifierRX_Limbic1 = (GRYPHON_ADDRESS << 3) | 1;//0x09      RX_Limbic2 = 1;   IdentifierRX_Limbic2 = (GRYPHON_ADDRESS << 3) | 2;//0x0A      RX_Limbic3 = 2;   IdentifierRX_Limbic3 = (GRYPHON_ADDRESS << 3) | 3;//0x0B      RX_Limbic4 = 3;   IdentifierRX_Limbic4 = (GRYPHON_ADDRESS << 3) | 4;//0x0C/*All CAN configurations that comes from the example*/result = FLEXCAN_Initialize_mailbox( CAN_DEVICE, RX_Limbic1, IdentifierRX_Limbic1, ack_len_code, FLEXCAN_RX, format, interrupt);   printf("\nFLEXCAN rx mailbox initialization. result: 0x%lx", result);   result = FLEXCAN_Activate_mailbox(CAN_DEVICE, RX_Limbic1, FLEXCAN_RX_MSG_BUFFER_EMPTY);   printf("\nFLEXCAN mailbox activation. result: 0x%lx", result);         /* Initialize mailbox */   result = FLEXCAN_Initialize_mailbox( CAN_DEVICE, RX_Limbic2, IdentifierRX_Limbic2, ack_len_code, FLEXCAN_RX, format, interrupt);   printf("\nFLEXCAN rx mailbox initialization. result: 0x%lx", result);   result = FLEXCAN_Activate_mailbox(CAN_DEVICE, RX_Limbic2, FLEXCAN_RX_MSG_BUFFER_EMPTY);   printf("\nFLEXCAN mailbox activation. result: 0x%lx", result);         /* Initialize mailbox */   result = FLEXCAN_Initialize_mailbox( CAN_DEVICE, RX_Limbic3, IdentifierRX_Limbic3, ack_len_code, FLEXCAN_RX, format, interrupt);   printf("\nFLEXCAN rx mailbox initialization. result: 0x%lx", result);   result = FLEXCAN_Activate_mailbox(CAN_DEVICE, RX_Limbic3, FLEXCAN_RX_MSG_BUFFER_EMPTY);   printf("\nFLEXCAN mailbox activation. result: 0x%lx", result);         /* Initialize mailbox */   result = FLEXCAN_Initialize_mailbox( CAN_DEVICE, RX_Limbic4, IdentifierRX_Limbic4, ack_len_code, FLEXCAN_RX, format, interrupt);   printf("\nFLEXCAN rx mailbox initialization. result: 0x%lx", result);   result = FLEXCAN_Activate_mailbox(CAN_DEVICE, RX_Limbic4, FLEXCAN_RX_MSG_BUFFER_EMPTY);   printf("\nFLEXCAN mailbox activation. result: 0x%lx", result);      /* Install ISR */   if(interrupt == FLEXCAN_ENABLE)   {      result = FLEXCAN_Install_isr( CAN_DEVICE, RX_Limbic1, (pointer)MY_FLEXCAN_ISR1 );      printf("\nFLEXCAN RX ISR install. result: 0x%lx", result);      result = FLEXCAN_Install_isr( CAN_DEVICE, RX_Limbic2, (pointer)MY_FLEXCAN_ISR2  );      printf("\nFLEXCAN RX remote ISR install. result: 0x%lx", result);            result = FLEXCAN_Install_isr( CAN_DEVICE, RX_Limbic3, (pointer)MY_FLEXCAN_ISR3  );      printf("\nFLEXCAN RX remote ISR install. result: 0x%lx", result);            result = FLEXCAN_Install_isr( CAN_DEVICE, RX_Limbic4, (pointer)MY_FLEXCAN_ISR4  );      printf("\nFLEXCAN RX remote ISR install. result: 0x%lx", result);         }while{1} //Just wait to catch interrupts with BP

 

I get 4 interruptions but only 2 ISRs instead of 4.

 

 

Hope you can help me with anything.

Message Edited by MQXuser on 2009-08-29 02:06 AM

Outcomes