AnsweredAssumed Answered

Issue in the communication between two MCAN modules

Question asked by Fabio Malatesta on Jul 25, 2018
Latest reply on Jul 27, 2018 by soledad

I am using the OM13094 (LPCXpresso54618 CAN-FD kit), which provides two can modules CAN1 and CAN0.
I also use the provided SDK.

 

I try to send a frame from CAN0 to CAN1. The frame is correctly received but CAN1 stores the frame in the wrong memory section (at MSG_RAM_BASE0+RX_FIFO1_OFS). In particular, it stores the frame as if the base address of the Message RAM used for CAN1 was the one used for CAN0.

 

I attach here an excerpt of the code:

 

#define MSG_RAM_BASE0 0x20010000U   //Base address of the Message Ram for CAN0
#define TX_BUFFER_OFS 0x00U
#define RX_FIFO1_OFS  0x20U
#define MSG_RAM_BASE1 0x20010050U //Base address of the Message Ram for CAN1

 

//Set Base Addresses

MCAN_SetMsgRAMBase(CAN0, MSG_RAM_BASE0);
MCAN_SetMsgRAMBase(CAN1, MSG_RAM_BASE1);

 

 /* RX fifo1 config for CAN1*/
 rxFifo1.address = RX_FIFO1_OFS;
 rxFifo1.elementSize = 1U;
 rxFifo1.watermark = 0;
 rxFifo1.opmode = kMCAN_FifoBlocking;
 rxFifo1.datafieldSize = kMCAN_8ByteDatafield;
 MCAN_SetRxFifo0Config(CAN1, &rxFifo1);

 

 /* TX buffer config for CAN0*/
 txBuffer.address = TX_BUFFER_OFS;
 txBuffer.dedicatedSize = 1U;
 txBuffer.fqSize = 0;
 txBuffer.datafieldSize = kMCAN_8ByteDatafield;
 MCAN_SetTxBufferConfig(CAN0, &txBuffer);


The frame received by CAN1 is stored at  address 0x20010020U  (MSG_RAM_BASE0 + RX_FIFO1_OFS) instead of  at  address 0x20010070U (MSG_RAM_BASE1 + RX_FIFO1_OFS).

 

Can someone provide any help about this?

 

 

Outcomes