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.

MSPM0G3507: MCAN module RX handling issue

Part Number: MSPM0G3507

Hi,

I am using MSPM0 launchpad for CAN bus communication. MSPM0 is connected via CAN transceiver to PCAN CAN bus analyzer.

When I send first two messages from PCAN they are received as expected, but after the second message MSPM0 starts to receive only each 3rd message.

For example:

1. SENT 0x01 RECEIVED 0x01 (RX Handler get proper data)

2. SENT 0x02 RECEIVED 0x02 (RX Handler get proper data)

3. SENT 0x03 RECEIVED 0x02 (RX Handler has data from previous message)

4. SENT 0x04 RECEIVED 0x02 (RX Handler has data from previous message)

5. SENT 0x05 RECEIVED 0x05 (RX Handler get proper data)

6. SENT 0x06 RECEIVED 0x05 (RX Handler has data from previous message)

7. SENT 0x07 RECEIVED 0x05 (RX Handler has data from previous message)

8. SENT 0x08 RECEIVED 0x08 (RX Handler get proper data) 

It seems like something has to be reseted after each RX process, but I don't understand what exactly. When I RESET the launchpad, it starts the same, first two messages are OK but then same issue.

The code that I'm using is the TI example for mcan data RX with FIFO memtype: 

DL_MCAN_readMsgRam(MCAN0_INST, DL_MCAN_MEM_TYPE_FIFO, 0U, rxFS.num, &rxMsg);

  • Hi Pavel Heyets 

    May I know which software you used on this test?

    Have you used the mcan_xxx driver library example on the mspm0 SDK MSPM0-SDK?

    Thanks

  • I am using the code from the mcan examples with some modification for my application.

    This is MCAN INTERRUPT HANDLER:

    void MCAN0_INST_IRQHandler(void)
    {
        switch (DL_MCAN_getPendingInterrupt(MCAN0_INST))
        {
            case DL_MCAN_IIDX_LINE1:
    
                /* Check MCAN interrupts fired during TX/RX of CAN package */
                gInterruptLine1Status |= DL_MCAN_getIntrStatus(MCAN0_INST);
                DL_MCAN_clearIntrStatus(MCAN0_INST, gInterruptLine1Status, DL_MCAN_INTR_SRC_MCAN_LINE_1);
    
                // DEBUG
                char msg[] = "MCAN Interrupt Received\n";
                siu_uart_tx_packet(msg, sizeof(msg)-1);
    
                if ((gInterruptLine1Status & MCAN_IR_RF0N_MASK) == MCAN_IR_RF0N_MASK)
                {
                    // DEBUG
                    char msg_mcan[] = "MCAN READING MSG\n";
                    siu_uart_tx_packet(msg_mcan, sizeof(msg_mcan)-1);
    
                    rxFS.num = DL_MCAN_RX_FIFO_NUM_0;
                    while ((rxFS.fillLvl) == 0) {
                        DL_MCAN_getRxFIFOStatus(MCAN0_INST, &rxFS);
                    }
    
                    DL_MCAN_readMsgRam(MCAN0_INST, DL_MCAN_MEM_TYPE_FIFO, 0U, rxFS.num, &rxMsg);
                    DL_MCAN_writeRxFIFOAck(MCAN0_INST, rxFS.num, rxFS.getIdx);
    
                    processRxMsg(&rxMsg);
                    gInterruptLine1Status &= ~(MCAN_IR_RF0N_MASK);
    
                }
    
                break;
    
            default:
                break;
        }
    }

    rxMsg Handler doesn't get the proper data when the readMsgRam function is running

    DL_MCAN_RxBufElement rxMsg;

    DL_MCAN_readMsgRam(MCAN0_INST, DL_MCAN_MEM_TYPE_FIFO, 0U, rxFS.num, &rxMsg);

  • Hi Pavel Heyets

    I need some time to look in the code. Thanks