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.

TDA4VM: How to deal with error of MCAN_ECR

Part Number: TDA4VM


HI,

with sample code below,occasional appearance MCAN_ECR error:

/* Checking for Errors */
            MCAN_getErrCounters(mcanModAddr, &errCounter);
            if ((0U == errCounter.recErrCnt) &&
                (0U == errCounter.canErrLogCnt))
            {
                MCAN_RxFIFOStatus fifoStatus;
                fifoStatus.num = (uint32_t)MCAN_RX_FIFO_NUM_1;
                MCAN_getRxFIFOStatus(mcanModAddr, &fifoStatus);
                MCAN_readMsgRam(mcanModAddr,
                                MCAN_MEM_TYPE_FIFO,
                                fifoStatus.getIdx,
                                (uint32_t)fifoStatus.num,
                                &rxMsg);
                (void)MCAN_writeRxFIFOAck(mcanModAddr,
                                          (uint32_t)fifoStatus.num,
                                          fifoStatus.getIdx);

            }
            else
            {
                appLogPrintf("MCAN: Error in reception %d: rec %d, cel %d!!!\n", inst->index, errCounter.recErrCnt, errCounter.canErrLogCnt);

            }

Maybe this issue is  because of bad can bus signal  or protocol error.I have some question,please give your help:

1.while met this issue for a short while, how can i do with this error about MCAN_ECR,ignore this error or discard this reveive message

2.how to clear ECR error ,such as rec domain

3,when i see rec is not zero,but why cel value is zero

  • Hi,

    1.while met this issue for a short while, how can i do with this error about MCAN_ECR,ignore this error or discard this reveive message

    I read through the IP spec and the MCAN_ECR's REC and TEC are counters for the aggregated number of Rx or Tx errors. An unsuccessful transfer will increment and a successful transfer will decrement these.

    So even when these counters are non zero but are decreasing, then the incoming messages are correctly received. So these messages should not be discarded.

    2.how to clear ECR error ,such as rec domain

    A successful reception will decrement the REC field of the ECR.

    3,when i see rec is not zero,but why cel value is zero

    The CEL fields description in the TRM says "The counter is incremented each time when a CAN protocol error causes the Transmit Error Counter or the Receive Error Counter to be incremented. It is reset by read access to the MCAN_ECR[23-16] CEL field. The counter stops at FFh; the next increment of the MCAN_ECR[7-0] TEC or MCAN_ECR[14-8] REC fields sets interrupt flag MCAN_IR[22] ELO."

    So maybe the read access to this field resets the CEL which is why you see 0 there.

    Regards

    Karan

  • Thans Karan

    Item2:

    You mean one successful Rx message,REC value will decrease.But one error Rx,REC value will increase.So as to REC error, i don't need to recover can driver.If i find REC value is greater than the last Rx,I just need to discard current RX message,because current RX message maybe is not exected.

    Is my understanding right?

    Item3:

    From upon sample code,I get ECR value and save it to structure errCounter firstly,I think after i have read the register,CEL value will reset to zero,but in structure errCounter,errCounter.canErrLogCnt should not be zero.

    Or CEL also decrease if one TX transfer succussfully?

    Please help check.

    Thanks

  • Hi,

    You mean one successful Rx message,REC value will decrease.But one error Rx,REC value will increase.So as to REC error, i don't need to recover can driver.If i find REC value is greater than the last Rx,I just need to discard current RX message,because current RX message maybe is not exected.

    Is my understanding right?

    Yes, this is right.

    From upon sample code,I get ECR value and save it to structure errCounter firstly,I think after i have read the register,CEL value will reset to zero,but in structure errCounter,errCounter.canErrLogCnt should not be zero.

    Or CEL also decrease if one TX transfer succussfully?

    I need to check this with the HW team on will even the reset happen after the value is read or just as soon as the read request is issued.

    Regards

    Karan