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.

[参考译文] TMS320F28377D:28377D:无法使用中断模式读取数据、CAN_ES 寄存器的 LEC 字段等于 7。

Guru**** 2535150 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1557179/tms320f28377d-28377d-unable-to-read-data-using-interrupt-mode-the-lec-field-of-the-can_es-register-equals-7

器件型号:TMS320F28377D


工具/软件:

您好专家、

   我使用中断 方法实现了 CAN 报文接收。  当 我 通过 CanTools 将数据发送到 MCU 时、 可以触发中断、但状态为 erro。

CANA 初始化代码 如下:

void InitCanA(void)
{
    CANInit(CANA_BASE);																// Initialize the CAN controller
    DELAY_US(10);

    
    CANClkSourceSelect(CANA_BASE, 0);												// Setup CAN to be clocked off the M3/Master subsystem clock
    DELAY_US(10);

    CANBitRateSet(CANA_BASE, MAIN_FREQ, CAN_BPR);                               	//200M  500K

    CANIntEnable(CANA_BASE, CAN_INT_MASTER | CAN_INT_ERROR | CAN_INT_STATUS);    	// Enable interrupts on the CAN peripheral.  在CAN外设上启用中断。

    CANGlobalIntEnable(CANA_BASE, CAN_GLB_INT_CANINT0);                          	// Enable CAN Global Interrupt line0.
    DELAY_US(20);

    CANEnable(CANA_BASE);															// Enable the CAN for operation.
}
 

中断服务例程代码为:μ s

  

EALLOW;  
	PieVectTable.CANA0_INT = &CANA0IntHandler;
EDIS;
IER |= M_INT9;

PieCtrlRegs.PIEIER9.bit.INTx5 = 1;

//can中断函数
interrupt void CANA0IntHandler(void)
{
    unsigned long ulStatus;

    ulStatus = CANIntStatus(CANA_BASE, CAN_INT_STS_CAUSE);
    if(ulStatus == CAN_INT_INT0ID_STATUS)
    {
        ulStatus = CANStatusGet(CANA_BASE, CAN_STS_CONTROL);

        if(((ulStatus  & ~(CAN_ES_TXOK | CAN_ES_RXOK)) != 7) &&((ulStatus  & ~(CAN_ES_TXOK | CAN_ES_RXOK)) != 0))
        {
            // Set a flag to indicate some errors may have occurred.
            g_bErrFlag = 1;
        }
    }
    else if(ulStatus == 1)
    {
        CANIntClear(CANA_BASE, 1);
        g_bErrFlag = 0;
    }
    else if(ulStatus == 2)
    {
        CANMessageGet(CANA_BASE, 2, &sRXCANMessage, true);
        CANIntClear(CANA_BASE, 2);

        g_bErrFlag = 0;
        g_uGetCanDate = 1;


    }

    CANGlobalIntClear(CANA_BASE, CAN_GLB_INT_CANINT0);
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP9;
}

但当我 将数据发送 到 MCU 时、可以触发中断。   

但 CAN 寄存器是  

如何正确地从我配置的邮箱检索数据?