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.
例程基本没做修改;CAN能发送数据,时序应该是是对的;
但是上位机发送数据时会出现崩溃;
[Cortex_R4_0] Exception occurred in ThreadType_Main.
Main handle: 0x0.
Main stack base: 0x8013488.
Main stack size: 0x1000.
R0 = 0x0000ac90 R8 = 0x00080000
R1 = 0x00002890 R9 = 0x00000000
R2 = 0x08014b38 R10 = 0x00000000
R3 = 0x08013488 R11 = 0xff500000
R4 = 0x00000000 R12 = 0x08014a74
R5 = 0x0000ac90 SP(R13) = 0x00000000
R6 = 0x0000f044 LR(R14) = 0x00008f14
R7 = 0x0000f088 PC(R15) = 0x00002890
PSR = 0x600c019f
DFSR = 0x00000808 IFSR = 0x00000000
DFAR = 0xfffffff8 IFAR = 0x00000000
ti.sysbios.family.arm.exc.Exception: line 205: E_dataAbort: pc = 0x00002890, lr = 0x00008f14.
xdc.runtime.Error.raise: terminating execution
接收函数赋值给回调函数,接收标志位接收完 gRxDoneFlag = 1;
mcanCfgParams->appDataCallBack = MCANAppCallback;
static void MCANAppCallback(CANFD_MsgObjHandle handle, CANFD_Reason reason)
{
Task_Params UART_taskParams;
int32_t errCode, retVal;
uint32_t id;
CANFD_MCANFrameType rxFrameType;
CANFD_MCANXidType rxIdType;
if (reason == CANFD_Reason_TX_COMPLETION)
{ {
gTxPkts++;
gTxDoneFlag = 1;
return;
} }
if (reason == CANFD_Reason_RX)
{ {
/* Reset the receive buffer */
memset(&rxData, 0, sizeof (rxData));
dataLength = 0;
retVal = CANFD_getData (handle, &id, &rxFrameType, &rxIdType, &rxDataLength,&rxData[0], &errCode);
//if (retVal < 0)
//{
// System_printf ("Error: CAN receive data for iteration %d failed [Error code %d]\n", iterationCount, errCode);
// return;
//}
/* Validate the data */
gRxPkts++;
gRxDoneFlag = 1;
return;
} }
if (reason == CANFD_Reason_TX_CANCELED)
{ {
gTxPkts++;
gTxDoneFlag = 1;
gRxDoneFlag = 1;
return;
} }
}