Error when CAN communication changes to FIFO0 mode in Buffer Mode

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Red_rabbit
Level 1
Level 1
First question asked Welcome!

#define TX_PIN IfxCan_TXD00_P20_8_OUT
#define RX_PIN IfxCan_RXD00B_P20_7_IN

void canIsrRxHandler_0(void)
{

IfxCan_Node_clearInterruptFlag(g_mcmcan.canSrcNode.node, IfxCan_Interrupt_rxFifo0NewMessage);


IfxCan_Can_readMessage(&g_mcmcan.canSrcNode, &g_mcmcan.rxMsg, g_mcmcan.rxData);

 if ( g_mcmcan.rxMsg.messageId == 0x500 )
 {
g_IrDA_DATA.Can_data[0] = g_mcmcan.rxData[0];
g_IrDA_DATA.Can_data[1] = g_mcmcan.rxData[1];
}

void initCan_0(void)
{

IfxCan_Can_initModuleConfig(&g_mcmcan.canConfig, &MODULE_CAN0);

IfxCan_Can_initModule(&g_mcmcan.canModule, &g_mcmcan.canConfig);

IfxCan_Can_initNodeConfig(&g_mcmcan.canNodeConfig, &g_mcmcan.canModule);

g_mcmcan.canNodeConfig.nodeId = IfxCan_NodeId_0;

g_mcmcan.canNodeConfig.frame.type = IfxCan_FrameType_transmitAndReceive;

g_mcmcan.canNodeConfig.txConfig.txMode = IfxCan_TxMode_fifo;
g_mcmcan.canNodeConfig.txConfig.dedicatedTxBuffersNumber = 2;
g_mcmcan.canNodeConfig.txConfig.txFifoQueueSize = 2;

g_mcmcan.canNodeConfig.rxConfig.rxMode = IfxCan_RxMode_fifo0;
g_mcmcan.canNodeConfig.rxConfig.rxFifo0OperatingMode = IfxCan_RxMode_fifo0;
g_mcmcan.canNodeConfig.rxConfig.rxFifo0Size= (uint8)8;

g_mcmcan.canNodeConfig.interruptConfig.transmissionCompletedEnabled = TRUE;
g_mcmcan.canNodeConfig.interruptConfig.traco.priority = ISR_PRIORITY_CAN_TX;
g_mcmcan.canNodeConfig.interruptConfig.traco.interruptLine = IfxCan_InterruptLine_0;
g_mcmcan.canNodeConfig.interruptConfig.traco.typeOfService = IfxSrc_Tos_cpu0;

g_mcmcan.canNodeConfig.interruptConfig.rxFifo0NewMessageEnabled = TRUE;
g_mcmcan.canNodeConfig.interruptConfig.rxf0n.interruptLine = IfxCan_InterruptLine_1;
g_mcmcan.canNodeConfig.interruptConfig.rxf0n.priority = ISR_PRIORITY_CAN_RX;
g_mcmcan.canNodeConfig.interruptConfig.rxf0n.typeOfService = IfxSrc_Tos_cpu0;

g_mcmcan.canNodeConfig.interruptConfig.rxFifo0FullEnabled = TRUE;
g_mcmcan.canNodeConfig.interruptConfig.rxf0f.interruptLine = IfxCan_InterruptLine_2;
g_mcmcan.canNodeConfig.interruptConfig.rxf0f.priority = ISR_PRIORITY_CAN_RX_1;
g_mcmcan.canNodeConfig.interruptConfig.rxf0f.typeOfService = IfxSrc_Tos_cpu0;

IfxCan_Can_Pins pins;
pins.rxPin = &RX_PIN;
pins.rxPinMode = IfxPort_InputMode_pullUp;
pins.txPin = &TX_PIN;
pins.txPinMode = IfxPort_OutputMode_pushPull;
pins.padDriver = IfxPort_PadDriver_cmosAutomotiveSpeed2;
g_mcmcan.canNodeConfig.pins = &pins;

IfxCan_Can_initNode(&g_mcmcan.canSrcNode, &g_mcmcan.canNodeConfig);

}

Transmit is OK,

result received is garbage data.

Red_rabbit_0-1647850428292.png

* Send Data

Red_rabbit_1-1647850758348.png

IfxCan_Can_readMessage(&g_mcmcan.canSrcNode, &g_mcmcan.rxMsg, g_mcmcan.rxData);

A trap occurs in the above source portion.

How do I modify the initialization code?

 

 

 

 

0 Likes
1 Reply
Di_W
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 100 likes received

Hi,

I have seen CLASS4 TID3,  looks like SBE error, which is in DATR register can be checked. You could set a breakpoint at Trap address to investigate where occurs the trap. DEADD is the address of TRAP occurs.

dw

0 Likes