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

cross mob
lock attach
Attachments are accessible only for community members.
Wayne
Level 1
Level 1
First reply posted 5 sign-ins First question asked

I am doing test CAN module with TC397XA and KIT_A2G_TC397XA board. IDE tool is Aurix development studio and I refered MCMCAN_1_KIT_TC397 code and content in community at the following link.
(https://community.infineon.com/t5/AURIX/TC397-CAN-cannot-work/m-p/325992)

KIT_A2G_TC397XA has 2 CAN port. (CAN0 node0 : P20_8, P20_7, CAN1 node0 P23_1, P23_0) 

When I set only MODULE_CAN0 configure , it works and I could see CAN signal but when I set MODULE_CAN1 configure, IfxCpu_Trap_busError is occured.
Attachment is my test code. Please review and let me know what my problem is.

0 Likes
9 Replies
Markus_K
Employee
Employee
First like given First reply posted Welcome!

All CAN modules share the same CAN_CLC register, so there is no CAN1_CLC register and there is no need to initialize it. In fact this leads to a trap if you try to do so.

Try again after removing IfxCan_Can_initModule(&g_mcmcan.canModule10, &g_mcmcan.canConfig10); in void InitCan10(void)

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

Hi Wayne,

Do you have TIN number?

For trap explaination, please refer to 6.3.5 System Bus and Peripheral Errors (Trap Class 4) in TriCore TC162P core archiecture Volume 1 of 2.pdf

dw_0-1653913692092.png

 

 

0 Likes
Wayne
Level 1
Level 1
First reply posted 5 sign-ins First question asked

 

Hello Markus_K and dw.

Thank you for feedback for my issue.

There was mistake in my source code. After add IfxCan_Can_initNodeConfig() in InitCan10(), I can see CAN signal on P20_8 using oscilloscope and Tx also interrupt triggered on CAN module0 node0 and CAN module1 node0.

But still there is a problem. Rx interrupt handler dose not been triggered.  I think,  there seems to be something I am missing. Could you please let me know what the missing point is?

0 Likes
Wayne
Level 1
Level 1
First reply posted 5 sign-ins First question asked

My purpose is to make a loop back between the CAN module 0 and CAN module 1 in KIT_A2G_TC397XA board.

Wayne_0-1653981951667.png

 

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

Hi Wayne, Do you want CAN0 node 0 and CAN 1 node 0 for loopback? Then do you tried Tx of CAN0 node 0 and CAN 1 node 0? And you said RX ISR handler not triggered is for CAN0 node 0 or CAN1 node 0?

You can debug step by step.

1) CAN0 node 0 Tx works?

2) CAN1 node 0 Tx works?

3) CAN0 node 0 Rx works?

4) CAN1 node 0 Rx works?

 

 

0 Likes
Wayne
Level 1
Level 1
First reply posted 5 sign-ins First question asked

 

Hello dw

 

1) CAN0 node 0 Tx works?

  • Yes, it works

2) CAN1 node 0 Tx works?

  • Yes, it works

3) CAN0 node 0 Rx works?

  •     No, it doesn`t works.

4) CAN1 node 0 Rx works?

  • No, it doesn`t works.

Do you have any example code for refering it?

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

Hi Wayne,

The ADS demo for MCMCAN is using loopback for node 0 and node 1 within same module. 

You can first using same module and then use different module.

https://www.infineon.com/aurix-expert-training/Infineon-AURIX_MULTICAN_1_KIT_TC297_TFT-TR-v01_00_03-...

https://github.com/Infineon/AURIX_code_examples/tree/master/code_examples

dw

0 Likes
Wayne
Level 1
Level 1
First reply posted 5 sign-ins First question asked

Hello

 I have already been do test MCMCAN demo and confirmed the operation. I want to make Tx/Rx behavior physically, not internal loopback. Because I don`t have any test equipment like a PCAN, I am trying to test by connecting two ports on evaluation board. 

Is there something wrong with my method? Please let me know what I am doing wrong.

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

I have seen in MCMCAN_1_KIT_TC397_TFT, node 0 is Tx and node 1 Rx as below:

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

    g_mcmcan.canNodeConfig.busLoopbackEnabled = TRUE;
    g_mcmcan.canNodeConfig.nodeId = IfxCan_NodeId_0;

    g_mcmcan.canNodeConfig.frame.type = IfxCan_FrameType_transmit;

    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;

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

    /* ==========================================================================================
     * Destination CAN node configuration and initialization:
     * ==========================================================================================
     *  - load default CAN node configuration into configuration structure
     *
     *  - set destination CAN node in the "Loop-Back" mode (no external pins are used)
     *  - assign destination CAN node to CAN node 1
     *
     *  - define the frame to be the receiving one
     *
     *  - once the message is stored in the dedicated RX buffer, raise the interrupt
     *  - define the receive interrupt priority
     *  - assign the interrupt line 1 to the receive interrupt
     *  - receive interrupt service routine should be serviced by the CPU0
     *
     *  - initialize the destination CAN node with the modified configuration
     * ==========================================================================================
     */
    IfxCan_Can_initNodeConfig(&g_mcmcan.canNodeConfig, &g_mcmcan.canModule);

    g_mcmcan.canNodeConfig.busLoopbackEnabled = TRUE;
    g_mcmcan.canNodeConfig.nodeId = IfxCan_NodeId_1;

    g_mcmcan.canNodeConfig.frame.type = IfxCan_FrameType_receive;

    g_mcmcan.canNodeConfig.interruptConfig.messageStoredToDedicatedRxBufferEnabled = TRUE;
    g_mcmcan.canNodeConfig.interruptConfig.reint.priority = ISR_PRIORITY_CAN_RX;
    g_mcmcan.canNodeConfig.interruptConfig.reint.interruptLine = IfxCan_InterruptLine_1;
    g_mcmcan.canNodeConfig.interruptConfig.reint.typeOfService = IfxSrc_Tos_cpu0;

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

    /* ==========================================================================================
     * CAN filter configuration and initialization:
     * ==========================================================================================
     *  - filter configuration is stored under the filter element number 0
     *  - store received frame in a dedicated RX Buffer
     *  - define the same message ID as defined for the TX message
     *  - assign the filter to the dedicated RX Buffer (RxBuffer0 in this case)
     *
     *  - initialize the standard filter with the modified configuration
     * ==========================================================================================
     */
    g_mcmcan.canFilter.number = 0;
    g_mcmcan.canFilter.elementConfiguration = IfxCan_FilterElementConfiguration_storeInRxBuffer;
    g_mcmcan.canFilter.id1 = CAN_MESSAGE_ID;
    g_mcmcan.canFilter.rxBufferOffset = IfxCan_RxBufferId_0;

    IfxCan_Can_setStandardFilter(&g_mcmcan.canDstNode, &g_mcmcan.canFilter);

Could you please try module 0 - node 0 is Tx and module 1 - node 0 is Rx only?

0 Likes