TC397XX CAN Bus data TX and RX not working

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

cross mob
rajeshkumar
Level 2
Level 2
First like received 10 sign-ins 5 replies posted

Hi,

I am using Aurix TC397XX controller and checking the CAN bus functionalities in our custom board. I am using the Aurix Code example "MCMCAN_1_KIT_TC397_TFT" and trying to do the Software CAN loopback as mentioned in the example code. I dont' see the TX and RX is happening in the CAN bus, even we did the Oscilloscope probing and confirmed the packets are not went out.

HW and Pin configuration in our board: P33.9 and P33.10 used, i.e. CAN0_NODE1.

From the "MCMCAN_1_KIT_TC397_TFT", I have used CAN0_NODE1 for source CAN and destination CAN configurations. Used CPU1 for interrupt handling.

From the debuging, I see below observations:

1. "txEventFifoSize" seen as 0 inside "IfxCan_Can_initNode" function. Do we need to set any explicit valid value for this variable? We hit the failure check of "txEventFifoSize", since it was set as 0 during the "IfxCan_Can_initNodeConfig" functions.

2. Currently only traco.priority Interrupt enabled inside "IfxCan_Can_initNode" function. Is it sufficient for TX/RX packet transmission?

3. Do i need to keep Interrupt configurations for TX and RX events? Is this really required for Packet send and receive?

4. I am doing the CAN pin (P33.9, P33.10 and Mode, Pad driver)configuration as part of Intial Aurix boot code. I see there is one more pin configuration sequence in the "IfxCan_Can_initNode" function. Currently I see the "config->pins" check against NULL in this function, Do i need to reconfigure the Pins again inside "IfxCan_Can_initNode" function?

5. Is the "MCMCAN_1_KIT_TC397_TFT" example code verified? Can I refer the same for my custom board with only Pin and CAN bus node changes?

6. In the CAN loopback mode, can we send and receive data in the same CAN node (i.e CAN0_NODE1), since the example code has different CAN nodes (node 0 and 1) for loopback test?

 

Thanks,

Rajesh

4 Replies
lock attach
Attachments are accessible only for community members.
ugo_8a
Employee
Employee
10 solutions authored 25 sign-ins 25 replies posted

Hi, in loopback mode the external pins are not used, this is why you do not see any activity. if you need to test your MCAN node here is an example code , is basically a echo application . You need to send a CAN message with ID 0x100 and some data, then you will get  reply with ID 0x200 and the same data you sent.

Basically is to test reception and transmission is ok. 

0 Likes

Hi I tried this, but I do not receive any message. Right now i am using pcan-view to trace the messages. Thanks!

0 Likes
rajeshkumar
Level 2
Level 2
First like received 10 sign-ins 5 replies posted

Hi @ugo_8a ,

 

I have taken your example code and run it on our custom board. The execution stuck at the below code.

It is looping in the while loop and not proceeding further.

while ((IfxCan_Can_isNewDataReceived(&g_CanBasic.drivers.canNode[0], (IfxCan_RxBufferId) rxMsg.bufferNumber)) == 0)
{};

 

I have changed only the PINs as below in the example code which you have provided.

IfxCan_Can_Pins pins;
pins.rxPin = &IfxCan_RXD01D_P33_10_IN;
pins.rxPinMode = IfxPort_InputMode_pullUp;
pins.txPin = &IfxCan_TXD01_P33_9_OUT;
pins.txPinMode = IfxPort_OutputMode_pushPull;
pins.padDriver = IfxPort_PadDriver_cmosAutomotiveSpeed2;
nodeConfig.pins = &pins;

Also, I changed the Node id from 0 to 1 based on the Pin configuration changes.

nodeConfig.nodeId = IfxCan_NodeId_1;

 

Do we need to enable the SW loopback variable  as part of init sequence?

nodeConfig.busLoopbackEnabled = TRUE;

Please provide your suggestions.

Thanks,

Rajesh

0 Likes
Di_W
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 250 solutions authored

Hi Rajesh,

1. "txEventFifoSize" seen as 0 inside "IfxCan_Can_initNode" function. Do we need to set any explicit valid value for this variable? We hit the failure check of "txEventFifoSize", since it was set as 0 during the "IfxCan_Can_initNodeConfig" functions.

No need to set as the demo project.

2. Currently only traco.priority Interrupt enabled inside "IfxCan_Can_initNode" function. Is it sufficient for TX/RX packet transmission?

Yes

3. Do i need to keep Interrupt configurations for TX and RX events? Is this really required for Packet send and receive?

Depends on your requirement.

4. I am doing the CAN pin (P33.9, P33.10 and Mode, Pad driver)configuration as part of Intial Aurix boot code. I see there is one more pin configuration sequence in the "IfxCan_Can_initNode" function. Currently I see the "config->pins" check against NULL in this function, Do i need to reconfigure the Pins again inside "IfxCan_Can_initNode" function?

If you use loopback, it's enough for demo project.

5. Is the "MCMCAN_1_KIT_TC397_TFT" example code verified? Can I refer the same for my custom board with only Pin and CAN bus node changes?

Verified. You can refer it for your board.

6. In the CAN loopback mode, can we send and receive data in the same CAN node (i.e CAN0_NODE1), since the example code has different CAN nodes (node 0 and 1) for loopback test?

Not sure, please use different nodes to try.

 

dw

0 Likes