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.

LAUNCHXL-F28P55X: Fails to re-initialize the MCAN interrupt after first trigger

Part Number: LAUNCHXL-F28P55X
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

Tool/software:

Hello,

We have configured MCAN [Classic configuration with 125Kbps] using Sysconfig. [Sysconfig Version 1.23.0 & C2000Ware Version 5.4.0.00].  We have successfully implemented transmit. But, we have partially successful in implementing the reception part using sysconfig tool. The reason for the failure is ISR is being triggered only for the first time & all subsequent reception of CAN messages has failed to trigger ISR. In order to get it to trigger again, We had to utilize some of the functions from CAN initialize called in Board_init() of  Board.c. Also, none of the interrupt clearing has helped in re-establishing ISR.

We have tried all the mentioned solution given under the thread below & none of them were useful 

 TMS320F280039C: MCAN interrupt will only trigger one time. 

 [Please refer the code snippet].

 

__interrupt void INT_PWR_CAN_0_ISR(void)
{  
    //uint32_t intrStatus;
    MCAN_RxNewDataStatus newData;


    intrStatus = MCAN_getIntrStatus(MCANA_DRIVER_BASE);
    

    //
    // Clear the interrupt Status.
    //
    MCAN_clearIntrStatus(MCANA_DRIVER_BASE, intrStatus);

    //
    //  Clearing the interrupt lineNum
    //

    MCAN_clearInterrupt(MCANA_DRIVER_BASE, 0x1); // Clear Int Line 0

   //
    //  Check to see if the interrupt is caused by a message being
    //  received in dedicated RX Buffers
    //
    if((MCAN_INTR_SRC_RX_FIFO0_NEW_MSG & intrStatus) == MCAN_INTR_SRC_RX_FIFO0_NEW_MSG)
    {
        //
        // Read the NewData registers
        //
        MCAN_getNewDataStatus(MCANA_DRIVER_BASE, &newData);
        //  If message is received in buffer element 0
        if((newData.statusLow & (1UL << 0U)) != 0)
        {
            MCAN_readMsgRam(MCANA_DRIVER_BASE, MCAN_MEM_TYPE_BUF, 0U,
                          0, &rxMsg1);        

            if((rxMsg[0].id >> 18U) == 0x40)
            {
              
            }
            else if((rxMsg[0].id >> 18U) == 0x42) 
            {
              
            }    
        }

        //
        //  Clearing the NewData registers
        //
        MCAN_clearNewDataStatus(MCANA_DRIVER_BASE, &newData);
        newData.statusLow = 0;

    }
    else
    {
        //error++;

        //
        //  Interrupt handling for other interrupt sources goes here
        //

    }
    //
    // Acknowledge this interrupt located in group 9
    //
   Interrupt_clearACKGroup(INT_PWR_CAN_0_INTERRUPT_ACK_GROUP);


//-----------------------------------------------------------------------------------
This code snippet used for re-initialising the ISR to get it to trigger subsequently
    MCAN_StdMsgIDFilterElement stdFiltelem_PWR_CAN;
    MCAN_setOpMode(PWR_CAN_BASE, MCAN_OPERATION_MODE_SW_INIT);
    while (MCAN_OPERATION_MODE_SW_INIT != MCAN_getOpMode(PWR_CAN_BASE));

    stdFiltelem_PWR_CAN.sft = MCAN_STDFILT_RANGE;
    stdFiltelem_PWR_CAN.sfec = MCAN_STDFILTEC_RXBUFF;
    stdFiltelem_PWR_CAN.sfid1 = 64;
    stdFiltelem_PWR_CAN.sfid2 = 0;    
    MCAN_addStdMsgIDFilter(PWR_CAN_BASE, 0U, &stdFiltelem_PWR_CAN);

    stdFiltelem_PWR_CAN.sft = MCAN_STDFILT_RANGE;
    stdFiltelem_PWR_CAN.sfec = MCAN_STDFILTEC_RXBUFF;
    stdFiltelem_PWR_CAN.sfid1 = 66;
    stdFiltelem_PWR_CAN.sfid2 = 0;
    MCAN_addStdMsgIDFilter(PWR_CAN_BASE, 1U, &stdFiltelem_PWR_CAN);

    MCAN_lpbkModeEnable(PWR_CAN_BASE, MCAN_LPBK_MODE_EXTERNAL, false);
    MCAN_setOpMode(PWR_CAN_BASE, MCAN_OPERATION_MODE_NORMAL);
    while (MCAN_OPERATION_MODE_NORMAL != MCAN_getOpMode(PWR_CAN_BASE));
//-----------------------------------------------------------------------------------

}

Please refer the snapshot of MCAN configuration

Regards,

Sharath

  • Hey Sharath,

    One thing I noticed upon reviewing the code you shared is that both of your standard range filters overlap with each other. STDFLT1 = 0-64 and STDFLT2 = 0-66. You should either update STDFLT2 to be 65-66 or change these from range filters to single ID filters to prevent any overlapping. The order of these filters is significant and will influence the order of message processing and associated interrupt generation.

    You also have the standard filters configured to Store in the RX Buffer but your interrupt is configured for New RX FIFO MSG, this means this interrupt will never be triggered when STDFLTID = 0-66.

    You should also make sure to use the "Use Calculatedd Starting Addresses" checkbox so that the proper message ram size and configuration is applied in the auto-generated code.

    Please review this feedback and the associated TRM chapter content regarding RX Filter Configuration and RX Buffer/FIFO[0:1] Configurations.

    Best Regards,

    Zackary Fleenor

  • Hello,

    We have changed the settings according to the suggestions & now we see ISR is getting called back on every message reception. But now the filter functionality does not seem to work. We have tried all filter settings, but all messages are received regardless of ID (That is, ISR is being triggered for all message ID). 

    The working ISR code (changed from the first trail mail) is as below:

    __interrupt void INT_PWR_CAN_0_ISR(void)
    {
        uint32_t intrStatus;
    
        intrStatus = MCAN_getIntrStatus(MCANA_DRIVER_BASE);
        
        //
        // Clear the interrupt Status.
        //
        MCAN_clearIntrStatus(MCANA_DRIVER_BASE, intrStatus);
    
        //
        //  Clearing the interrupt lineNum
        //
    
        MCAN_clearInterrupt(MCANA_DRIVER_BASE, 0x1); // Clear Int Line 0
    
        //
        //  Check to see if the interrupt is caused by a new message being
        //  received in RX FIFO 1
        //
        
        if(((MCAN_INTR_SRC_RX_FIFO0_NEW_MSG) & intrStatus) == (MCAN_INTR_SRC_RX_FIFO0_NEW_MSG))
        {
                MCAN_readMsgRam(MCANA_DRIVER_BASE, MCAN_MEM_TYPE_FIFO, 0U, MCAN_RX_FIFO_NUM_0, &rxMsg1);
                if(rxMsg1.data[0] == 0x50) {
                  GPIO_writePin(FaultLED_Output,0);
                }
                else {
                  GPIO_writePin(FaultLED_Output,1);
                }
                RxFS.num = MCAN_RX_FIFO_NUM_0;
    
                MCAN_writeRxFIFOAck(MCANA_DRIVER_BASE, MCAN_RX_FIFO_NUM_0, RxFS.getIdx);
        }
        else
        {
            //error++;
    
            //
            //  Interrupt handling for other interrupt sources goes here
            //
    
        }
        //
        // Acknowledge this interrupt located in group 9
        //
       Interrupt_clearACKGroup(INT_PWR_CAN_0_INTERRUPT_ACK_GROUP);
    
    }

    Sys config file settings is as below snapshots provided 

    Initially "Enable Additional Core Configurations" was unchecked and all CAN IDs were being accepted regardless of filter settings. So the "Enable Additional Core Configurations" was enabled and the highlighted fields were accepting "Non-matching frames" to 'RX FIFO 0' by default. When changed to 'Reject', the ISR is not being triggered even if the ID set in filters are matching. 

    PS: We are using standard 11 bit Message identifier & trying to accept messages with ID between 0x40 to 0x42.

    Regards,

    Sharath

  • Hello Sharath,

    Apologies for the delayed response. Can you provide the .syscfg file and associated .c file where the MCAN configuration/functions are hosted for review?

    It is difficult to grasp the true configuration from screenshots alone.

    Best Regards,

    Zackary Fleenor

  • Ref.zip

    Hello,

    We got the CAN working as per desired requirement. Anyways thanks for the kind help & support. Also, I have attached the working code snippet & syscfg file for reference in Ref.zip.

    PFA the