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.

SK-AM62A-LP: mcu-mcan can't no receive data from can box

Part Number: SK-AM62A-LP
Other Parts Discussed in Thread: SYSCONFIG

flollow case:

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1310883/sk-am62a-lp-mcan-mcan_loopback_interrupt-can-t-boot-up

I port 

examples\drivers\mcan\mcan_loopback_interrupt\am62ax-sk\mcu-r5fss0-0_freertos

to the 

examples\drivers\ipc\ipc_rpmsg_echo_linux\am62ax-sk\mcu-r5fss0-0_freertos

in this way ,I can debug the can,debug use can1 ,the pinmux is right ,but I find I can't no receive data from can box

Fullscreen
1
2
3
4
5
6
7
8
9
root@am62axx-evm:/opt/edgeai-gst-apps# devmem2 0x0408403C
/dev/mem opened.
Memory mapped at address 0xffff9954b000.
Read at address 0x0408403C (0xffff9954b03c): 0x00010000
root@am62axx-evm:/opt/edgeai-gst-apps# devmem2 0x04084040
/dev/mem opened.
Memory mapped at address 0xffff8ef1f000.
Read at address 0x04084040 (0xffff8ef1f040): 0x00050000
root@am62axx-evm:/opt/edgeai-gst-apps#
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

the mcan_loopback_interrupt_main code is :

Fullscreen
1
2
3
4
5
6
7
8
9
void ipc_rpmsg_echo_main(void *args);
void mcan_loopback_interrupt_main(void *args);
void freertos_main(void *args)
{ mcan_loopback_interrupt_main(NULL);
ipc_rpmsg_echo_main(NULL);
vTaskDelete(NULL);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

0763.mcan_loopback_interrupt.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
* Copyright (C) 2021 Texas Instruments Incorporated
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

when I send data to mcan(soc),the can box notify send fail,so the can has problem

and isr has no irq update

Fullscreen
1
2
3
[MCAN] Loopback Interrupt mode, application started ...
configParams 0 2 5 7 0 2 3 1!!
[MCAN] Wait for Rx 1completion, application started ...
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

You can see my code for more details

Fullscreen
1
2
3
4
/* if (TRUE == enableInternalLpbk)
{
MCAN_lpbkModeEnable(gMcanBaseAddr, MCAN_LPBK_MODE_INTERNAL, TRUE);
}*/
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi,

    Could you describe more about the hardware setup you have, and pins connected?

    To test MCAN on AM62A SK, we use the CAN-FD controller on the AM62A and 1x external CAN transceiver, which completes one node on the CAN bus. Connect the CAN transceiver to AM62A as shown in the following diagram:



    Then, the MCAN_H and MCAN_L pins from transceiver can be connected to CAN-to-USB connector to send/receive data via PC.

    Regards,
    Aparna

  • Hardware Connection Diagram

    _H _L connect to the can box of USBCANFD U200u

  • Hi, 

    The code changes made in mcan_loopback_interrupt.c looks correct.

    Please check the following:

    1) Probe the pins to eliminate any hardware related faults. 

    2) Make sure the MCU_MCAN instance used is the same as set in syscfg.

    Regards, 
    Aparna

  • 1: I think There's no problem with the peripheral circuit

    for rx,I can receive signal for PC can box,

    2.about pinmux,I add print ,it is ok

    the adapter address is right ,I use mcu mcan1

    #define APP_MCAN_BASE_ADDR (CONFIG_MCAN1_BASE_ADDR)
    #define APP_MCAN_INTR_NUM (CONFIG_MCAN1_INTR)

    #define CONFIG_MCAN1_BASE_ADDR (CSL_MCU_MCAN1_MSGMEM_RAM_BASE)
    #define CONFIG_MCAN1_INTR (46U)

    #define CSL_MCU_MCAN1_MSGMEM_RAM_BASE (0x4e10000UL)

  • 1: I think There's no problem with the peripheral circuit

    for rx,I can receive signal for PC can box,

    2.about pinmux,I add print ,it is ok

    the adapter address is right ,I use mcu mcan1

    #define APP_MCAN_BASE_ADDR (CONFIG_MCAN1_BASE_ADDR)
    #define APP_MCAN_INTR_NUM (CONFIG_MCAN1_INTR)

    #define CONFIG_MCAN1_BASE_ADDR (CSL_MCU_MCAN1_MSGMEM_RAM_BASE)
    #define CONFIG_MCAN1_INTR (46U)

    #define CSL_MCU_MCAN1_MSGMEM_RAM_BASE (0x4e10000UL)

    Last update:

    when canbox PC send canfd data to board,It has isr ,I print isr status 

    my settings on can box is right?

  • Hi, 

    The MCAN config template file didn't contain the code to convert the decimal value to hex value. Please update the mcan_config.c.xdt file with the below code. 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    %%{
    let module = system.modules['/drivers/mcan/mcan'];
    %%}
    /*
    * MCAN
    */
    /* MCASP Default Bit timing Parameters */
    MCAN_BitTimingParams gMcanBitTimingDefaultParams =
    {
    .nomRatePrescalar = 0x`module.$static.nomRatePrescalar.toString(16).toUpperCase()`U,
    .nomTimeSeg1 = 0x`module.$static.nomTimeSeg1.toString(16).toUpperCase()`U,
    .nomTimeSeg2 = 0x`module.$static.nomTimeSeg2.toString(16).toUpperCase()`U,
    .nomSynchJumpWidth = 0x`module.$static.nomSynchJumpWidth.toString(16).toUpperCase()`U,
    .dataRatePrescalar = 0x`module.$static.dataRatePrescalar.toString(16).toUpperCase()`U,
    .dataTimeSeg1 = 0x`module.$static.dataTimeSeg1.toString(16).toUpperCase()`U,
    .dataTimeSeg2 = 0x`module.$static.dataTimeSeg2.toString(16).toUpperCase()`U,
    .dataSynchJumpWidth = 0x`module.$static.dataSynchJumpWidth.toString(16).toUpperCase()`U,
    };
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    The mcan_config.c.xdt file is located at path {MCU+SDK}/source/drivers/.meta/mcan/templates. After updating the file restart the sysconfig tool and it will work fine.

    Please let me know if this solution works for you.

    Regards,
    Aparna

  • update mcan_config.c.xdt to {MCU+SDK}/source/drivers/.meta/mcan/templates/mcan_config.c.xdt 

    the make -j,update mcu_plus_sdk_am62ax_08_06_00_18\examples\drivers\ipc\ipc_rpmsg_echo_linux\am62ax-sk\mcu-r5fss0-0_freertos\ti-arm-clang\am62a-mcu-r5f0_0-fw to /lib/firmware/pdk-ipc/am62a-mcu-r5f0_0-fw

    on therside,I print the paramter of can

     

  • Hi, 

    Any updates on this issue?
    Have you been able to solve it or need any assistance?

    Regards,
    Aparna

  • hi

    sorry for late reply,It doesn't solve this issue yet。

    In our testing, we have not yet been able to receive data on the board and maintain the original state of the problem

  • Hi, 

    Sorry to hear that!

    There is less clarity as to why external MCAN connection is not established here. 
    I will update you if there is any related information.

    Regards,
    Aparna

  • Hi, 

    I have tested the external loopback example (with a different transceiver device), and after a few modifications of this example: 
    examples\drivers\mcan\mcan_loopback_interrupt\am62ax-sk\mcu-r5fss0-0_freertos
    it works for me. 

    I have used MCU_MCAN0 instance to test MCAN in external loopback setup. I have set MCAN bit timing parameters (bit rates and sampling points) correctly.

    To calculate Sampling point, use this formula:

    Sampling Point (%) = (1 + TSEG1) / (1 + TSEG1 + TSEG2)

    Reference code:

    5710.empty_am62ax-sk_mcu-r5fss0-0_freertos_ti-arm-clang.zip

    Hardware setup image:



    Output image:



    Regards,
    Aparna