This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0G3107: CAN TX Message Change

Part Number: MSPM0G3107
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi, 

I'm encountering one issue in a new product using MSPM0G3107 and the MCAN. Our customer reported that our product randomly send invalid responds when the system controller request data from our product. I duplicated the issue on bench successfully with experiment. Here're the details.

I tried to send out one message in each 10ms and using a CAN protocol analyzer to capture the data on the CAN bus. All the messages were OK if there's only the MSPM0 board was transmitting. But If I use a PCAN USB-CAN adaptor and the PCAN-Viewer GUI to send out several messages to the BUS at fixed frequency. Sometimes the message from MSPM0 changed to other value. Sometimes the CAN_ID changed to all zero but data field was correct. Sometimes, the the ID was correct, but the data changed to other value. One clue is, when the data changed, the first several bytes seems to be always constant.

Some messages captured:

Here's the Tx function I used for testing:

void DrvCanTxMsg(void)
{
DL_MCAN_TxFIFOStatus sTxFifoStatus;
Uint16 i;
static Uint8 cnt = 0;

DL_MCAN_getTxFIFOQueStatus(MCAN0_INST, &sTxFifoStatus);
if(!sTxFifoStatus.fifoFull) // send if tx fifo is not full
{
/* Initialize message to transmit. */
/* Identifier Value. */
sTxMsg.id = (Uint32)0x0547 << 18U;
sTxMsg.xtd = 0;

/* Transmit data frame. */
sTxMsg.rtr = 0U;
/* ESI bit in CAN FD format depends only on error passive flag. */
sTxMsg.esi = 0U;
/* data length */
sTxMsg.dlc = 8;
/* CAN FD frames transmitted without bit rate switching */
sTxMsg.brs = 0U;
/* Frame transmitted in Classic CAN format */
sTxMsg.fdf = 0U;
/* Store Tx events. */
sTxMsg.efc = 1U;
/* Message Marker. */
sTxMsg.mm = 0xAAU;
/* Data bytes. */
for(i = 0; i < 7; i++)
{
sTxMsg.data[i] = 0;
}
sTxMsg.data[7] = cnt;
cnt++;

/* Write Tx Message to the Message RAM. */
DL_MCAN_writeMsgRam(MCAN0_INST, DL_MCAN_MEM_TYPE_FIFO, 0, &sTxMsg);

/* Add request for transmission. */
DL_MCAN_TXBufAddReq(MCAN0_INST, sTxFifoStatus.putIdx);
}
}

The CAN is configured to 1M bitrate, the configuration is shown below.

More information, at the beginning I though this might be a problem of the TX FIFO, so I did a experiment to TX message using dedicated buffer, the issue is the same. 

Please help to check what's problem. Thanks!

  • Hi,

    I noticed that address for TX FIFO and RX FIFO are overlapped. Could you modify it and test again?

    (Please note there is no error/warning in Sysconfig now when address overlap so you need to configure it carefully)

  • Hi, Yuhao, 

    Thanks for the reply. This might be my problem. I though the address is configurated by sysconfig automatically. Do you have any guide for how to config the addresses? Can you please give a example config for addresses for my application? 

  • For the configuration of CAN, please refer to the example code, which implements CAN TX and CAN RX together:

    can_to_uart_bridge

  • Hi, Yuhao,

    My issue is resolved after modify the addresses. Thanks a lot for you support!  

    I've another question. The sysconfig is not supporting to config two ID filters. Can you please provide sample code for how to add more ID filters in user application? In my application, i use 11bit ID, where 7 bits of them are treated as node-id. So I want to accept 2 numbers in the 7 bits of CAN_ID, its own node-ID and all 0 (broadcasting address). 

  • Hi Vim,

    Nice to hear that you resolved your issue. 

    For your new question, could you create a new thread so we can keep this thread as a discussion for a single specific question. Thanks.