TC38XX MCAN Loopback mode Transmission completed but No new data on RX

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

cross mob
User20349
Level 1
Level 1
Dear Experts,

I have newly started with TC38xx board . I was trying to configure MCAN based upon Infineon-iLLD_TC38A_UM_1_0_1_11_0-Software-v01_00-EN.

Here is what I am trying to do:-
1. Configure CAN0 Node0 as receiver node.
2. Configure CAN0 Node1 as transmitter node.
3. Do communication in loopback node by using internal CAN bus by NPCR[LBM].

Here is what I observed:-
1. Transmission is completed successfully and I can see the data in TX Buffer and also TC interrupt flag is set.
2. No new data flag is set. So receive function is stuck.
3. As soon as data is transmitted RF0L interrupt is getting generated.

Can someone help in this?
I donot know what is the reason RF0L is getting triggered , I am suspecting filter issue.
0 Likes
8 Replies
User20349
Level 1
Level 1
Update:- New data Flag was not set due to filter not matching, Filter was written to RAM buffer without clearing it first which resulted in wrong filter setting.
0 Likes
User9635
Level 4
Level 4
50 replies posted 50 questions asked 25 replies posted
Hello,
Can you please confirm if you are able to send and receive CAN Message through the CAN Peripheral to some External CAN Monitoring device with correct message bytes in both direction.
My advice, first verify with external CAN Monitor before using the internal LoopBack Mode.
That will resolve your CAN Peripheral Driver issue.
Please ensure you are able to use CAN Channel X and Y separately using external CAN Monitor for each Receive and Transmit Mode.
Then it will be easy for me to help you out.
Best Regards
0 Likes
User20349
Level 1
Level 1
Hi,
First of all thank you for reply!!

Implementation for external CAN bus is not even working for me. It always give me Acknowledgment error.
Here is what I have done for external bus:-

1. CAN 0 Node 0 as both transmit and receive.
2. Pin Config as:-
define RX_PIN IfxCan_RXD00B_P20_7_IN
#define TX_PIN IfxCan_TXD00_P20_8_OUT
const IfxCan_Can_Pins pins =
{
&RX_PIN, IfxPort_InputMode_pullUp, /* RX port pin */
&TX_PIN, IfxPort_OutputMode_pushPull, /* TX port pin */
IfxPort_PadDriver_cmosAutomotiveSpeed1
};
nodeConfig.pins = &pins;
3. Tx in dedicated buffer.
4. Rx in dedicated buffer/ FIFO(both tried separately)

Here is what I observe:-
Receive:-
1. CAN interface always shows acknowledgement error "ECC: 110001110xxxxx, Not Acknowledge error, dominant error flag, Bit Position = 99 "..
2. ON controller side its stuck in while loop always, as no new data in fifo or dedicated buffer.

Transmit:-
1. It writes the data is transmit buffer.
2. But after giving Buffer add request, it always keeps in pending state , ie BRP is set.
3. PSR.LEC says Bit0 error.
4. IR shows interrupts raised for EW, PEA, EP and BO. and busoff is happening.

My conclusion:-
I believe that , I am missing some sort of configuration to enable CAN transceiver present on the TC38x board.
Which results into CAN Interface module not even identifying that controller is present on the BUS.
Is there something which needs to be done to enable transceiver on the board? or it is some other issue?

Thanks and regards,
Miftahul Islam
0 Likes
User9635
Level 4
Level 4
50 replies posted 50 questions asked 25 replies posted
Hello,
I am assuming you are using standard Infineon TC38x Triboard for this initial testing.
Default Oscillator on the board is 20MHz.
So, did you check all the PLL and CAN Settings for the CAN Baud Rate on the Bus?
Also, on the external CAN Monitor side, correct matching Baud Rate is done?
The Triboard CAN Terminal Polarities are correct as well as the Cable Length are small from Triboard to CAN Monitor Adapter?
Other usual CAN Signal Integrity and Termination/Twisted Cables are correct?
Best Regards
0 Likes
User20349
Level 1
Level 1
Hi,

The issue is resolved for physical CAN Bus now. There were couple of things which I was not doing properly:-
1. PIN was not set correctly for TX, which resulted into BIT0 error.
2. Once I corrected PIN setting, Baud rate was wrong, after correcting baud-rate value in NBTP0 register things are working fine now.

I will now check for LBM and update on forum about its progress.

Thanks for support 🙂
0 Likes
User21321
Level 2
Level 2
First like received
Hello!
I am using following setting for CAN Transmit but it is not working. It stuck in the while loop of CanTransmit block:

#define TX_PIN IfxCan_TXD00_P20_8_OUT
#define RX_PIN IfxCan_RXD00B_P20_7_IN

typedef struct
{
IfxCan_Can_Config canConfig; /* CAN module configuration structure */
IfxCan_Can canModule; /* CAN module handle */
IfxCan_Can_Node canSrcNode; /* CAN source node handle data structure */
IfxCan_Can_NodeConfig canNodeConfig; /* CAN node configuration structure */
IfxCan_Filter canFilter; /* CAN filter configuration structure */
IfxCan_Message txMsg; /* Transmitted CAN message structure */
IfxCan_Message rxMsg; /* Received CAN message structure */
} McmcanType;

McmcanType stg_CanCtrl;

void Can_Init(void)
{
const IfxCan_Can_Pins pins =
{
&TX_PIN, IfxPort_OutputMode_pushPull,
&RX_PIN, IfxPort_InputMode_pullUp,
IfxPort_PadDriver_cmosAutomotiveSpeed1
};

IfxCan_Can_initModuleConfig(&stg_CanCtrl.canConfig, &MODULE_CAN0);

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

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

stg_CanCtrl.canNodeConfig.baudRate.baudrate = CAN_BUADRATE;
stg_CanCtrl.canNodeConfig.nodeId = IfxCan_NodeId_0;
stg_CanCtrl.canNodeConfig.pins = &pins;
stg_CanCtrl.canNodeConfig.frame.type = IfxCan_FrameType_transmit;
IfxCan_Can_initNode(&stg_CanCtrl.canSrcNode, &stg_CanCtrl.canNodeConfig);

}

void CanTransmit(void)
{

IfxCan_Can_initMessage(&stg_CanCtrl.txMsg);

stg_CanObcData.DataType.u8_Data[0] = 0;
stg_CanObcData.DataType.u8_Data[1] = 0;
stg_CanObcData.DataType.u8_Data[2] = 0;
stg_CanObcData.DataType.u8_Data[3] = 0;
stg_CanObcData.DataType.u8_Data[4] = 0;
stg_CanObcData.DataType.u8_Data[5] = 0;
stg_CanObcData.DataType.u8_Data[6] = 0;
stg_CanObcData.DataType.u8_Data[7] = 0;

stg_CanCtrl.txMsg.messageId = CAN_ID;

while( IfxCan_Status_notSentBusy ==
IfxCan_Can_sendMessage(&stg_CanCtrl.canSrcNode, &stg_CanCtrl.txMsg, &stg_CanObcData.DataType.u32_Data[0]) )
{
}
}
0 Likes

Could you solve it?

 

0 Likes
fittori
Level 1
Level 1
5 replies posted 5 sign-ins First question asked

Hi,

How did you set the correct pin and the baud rate?

0 Likes