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.

[TDA4M]-Facing issues while running "R5F"application from vision apps side

Other Parts Discussed in Thread: SYSBIOS

Hello ,

Experiment done to enable CAN messages in PC from board

1. Created MCAN standalone application( took reference from cockpit demos for MCAN code)  on R5F core in vision apps.

2. Followed below steps since its building R5F core 

4.1.2.10.3.2 SD Card Boot section from below user guide

../../psdk_rtos_auto_j7_06_01_00_15/gateway-demos/index.html 

3. Minicom Logs observed as below:-

Welcome to minicom 2.7.1


OPTIONS: I18n                                                                
Compiled on Aug 13 2017, 15:25:34.                                           
Port /dev/ttyUSB0, 22:29:52                                                  
                                                                             
Press CTRL-A Z for help on special keys                                      
                                                                             
0x410002                                                                     
        0x810004                                                             
                0x4001000                                                    
                         0x4401380                                           
                                  0x41000B                                   

                                          0x810004

 

Kindly suggest me how to run MCAN application in the above scenario.

Regards,

Pooja Krishna

  • Hi Pooja,

    The prints you see on the minicom with device /dev/ttyUSB0 are sysfw prints, can you attach prints from the other device /dev/ttyUSB1?

    run minicom with the following command-

    sudo minicom --device /dev/ttyUSB1

    Regards,

    Karan

  • Hi Karan,

    1. As suggested by you, ran the CAN standalone application with following settings :

    CORE used - mcu2_0
    MCU UART used - J43
    MINICOM port set to USB1

    No prints observed on minicom log.

    2. I am working on CAN to achieve the following objective and hence finding out ways for the same

    We have an application graph with models and algorithms running on multiple cores. We need to send and receive messages through CAN for the above application.


    Could you suggest some road map to achieve the above objective?
    Just like TDA2x DCAN module, is there any module(code) that runs asynchronously with the Application graph that we can use?

    Thanks and Regards

    Pooja Krishna

  • Hi Pooja,

    1. Cockpit demo is not currently supported in the SDK but still, what you can check is that if the print functions correct? If you are using the same piece of code form cockpit apps then the print function might be different and might not work with vision apps. Also, the cockpit apps code runs on mcu2_1, is there a reason you are running on mcu2_0?

    2. We do not have a node for in vision apps right now like there was for DCAN in TDA2x.

    Regards,

    Karan

  • Hi Pooja,

    As mentioned in the documentation section 5.3.1, You should connect the  main uart cable first and then mcu uart cable.

    Because of that, ttyUSB0 is showing logs from SYSFW.

    Once you fix it, ttyUSB0 will show the logs from Linux kernel.


    Also note that the CAN application DOES not use any prints, so there won't be any prints from R5 app on the console.

    You will have to explictly add that if required.

    Regards,

    NIkhil D

  • Hello Karan,

    1. Changes made apart from cockpit demo code for CAN application are as below:-

    1.1. Added API "MCAN_writeMsgRam" to transmit dummy messages from board to PC.

    1.2. Added system_printf in main function call of CAN standalone application but no prints observed while boot up prints happened in main UART(USB0).

    1.3. Also I have used CPU_ID = mcu2_1 only.

    2. In that case , any detailed inputs in this node creation will be appreciated.

    Thanks and Regards

    Pooja Krishna

  • Hello Nikhil,

    1. PSDK version used is 06_01_00_15, section 4.1.2.10.3.2 is referred currently for my application.Please correct me in case of any deviation.

    BOARD SETUP DONE :-


    1. Connected the MCAN0 (J30) port to PC using Kvaser CAN transceiver.
    2. Connected MAIN UART first (USB0 to USB3).
    3. Connected MCU UART next (USB4 to USB5).


    SD CARD CHANGES DONE :-

    1. Created a bootable SD card with SBL bootloader and System Firmware.
    2. Copied the generated .out from ../../psdk_rtos_auto_j7_06_01_00_15/vision_apps/out/J7/R5F/SYSBIOS/release/vx_app_mcan.out in SD cards "BOOT" folder and renamed as "app.out".


    OBSERVATIONS:-

    1. In minicom port "USB0" ,could not observe any difference in log prints with/without app.out in boot folder.
    2. For prints to happen ,explicitly added "system_printf "in main function call, still could not observe any prints while booting up in USB 0 port.

    Kindly provide me the inputs in the above case.

    Thanks and Regards

    Pooja Krishna

  • Hi Pooja,

    As I mentioned earlier, USB0 uart is used by Linux. ANy prints from R5 core is not expected to appear on that console.

    If you want to debug, you should initialize one of the uart and print or use CCS to debug

    Regards,

    Nikhil D

  • Hello Nikhil,

    1.In SD card boot method, how to test if the application build for main_cortex_R5_0_1 is triggered .

    Kindly provide me the input for the same.

    2. For better clarity, opened separate thread to discuss using CCS approach as below:-

    e2e.ti.com/.../872040

    Thanks and Regards

    Pooja Krishna

  • Hi Pooja,

    Linux only boots the R5 firmware. You can check the kernel boot logs for prints from remoteproc driver.

    As I mentioned earlier, you can initialize a UART and print your messages on the UART as well.

    You can always connect CCS and connect to the core to see where the PC (program counter) is

    Regards,

    NIkhil D

  • Hello Nikhil,

    1. Created library for R5F for standalone MCAN application (PATH - vision_apps/utils) and called "app_mcan_init()" in "app_init()" (PATH - app_tirtos/common).

    2. Observed prints added in "app_mcan_init" logged upon running "./vision_apps_init.sh"  command.

    3. Have used task_create API to register the tasks but am unable to receive any CAN Messages on PC side.

    Kindly suggest

    Thanks and Regards

    Pooja Krishna

  • Hello Nikhil,

    1. Currently am able to run the MCAN application on mcu2_1 core and observing CAN messages as below snap:-

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/PC_5F00_MCAN_5F00_Data.PNG

    Highlighted the mcan_run code for reference

    /* Initialize message to transmit */
                txMsg.id  = 21;//(uint32_t)((uint32_t)(0x4U) << 18U);
                txMsg.rtr = 0U;
                txMsg.xtd = 0U;
                txMsg.esi = 0U;
                txMsg.dlc = 0x8;//0xFU;
                txMsg.brs = 1U;
                txMsg.fdf = 1U;
                txMsg.efc = 1U;
                txMsg.mm  = 0xAAU;

                /* Fill the Tx buffer with data */
                int byte_size;

                for(byte_size= 0;byte_size<MCAN_MAX_PAYLOAD_BYTES;byte_size++)
                {
                    txMsg.data[byte_size] = 11;

                }

                /* Write message to Msg RAM */

                MCAN_writeMsgRam(APP_MCAN2_BASEADDR,

                                 MCAN_MEM_TYPE_FIFO,
                                 0,
                                 &txMsg);

                configStatus = MCAN_txBufAddReq(APP_MCAN2_BASEADDR, 1U);

    Kindly let me know the reason for sending msg as "0" instead of "11".

    Thanks and Regards

    Pooja Krishna

  • Hi Pooja,

    For triggering the message on the bus you use -  

    I think what you are receiving is garbage data which is there is Buffer 1.

    Can you use the following APIs to write and add request - (use buffer instead of FIFO)

    1. MCAN_writeMsgRam(APP_MCAN2_BASEADDR, MCAN_MEM_TYPE_BUF, 0, &txMsg);

    This will write the CAN message to Tx buffer #0 of the MCAN MSG RAM.

    2. MCAN_txBufAddReq(APP_MCAN2_BASEADDR, 0);

    This will add the transmission request for the CAN message stored at Tx buffer #0 of the MCAN MSG RAM.

    Also, if you can get a memory dump after the step1, you will be able to see the you CAN message data at the message RAM of the MCAN instance you are using.

    A few questions - 

    1. How do you run the application? Are you using CCS to run?

    2. What is the value of the mcaro APP_MCAN2_BASEADDR?

    Regards,

    Karan

  • Hi Karan,

    Kindly find the info related to your queries

    1. Am running using SD boot mode without CCS.


    2. #define APP_MCAN2_BASEADDR                       (CSL_MCAN2_MSGMEM_RAM_BASE)
       #define CSL_MCAN2_MSGMEM_RAM_BASE                                                                  (0x2728000UL)

    3. After adding APIs to write and add request changes ,

    Observation

    CAN messages shown as  "ERROR FRAMES" .

    4. So removed FIFO related initialization to Message RAM Sections Configuration Parameters

    Observations

    No CAN messages seen on PC side from board

    No error invoked in the called APIs.

    Kindly let me know some input on this 

    Thanks and Regards

    Pooja Krishna

  • Pooja,

    Do you have the MCAN buffers initiallization code in your application? Or is it just FIFO initiallization code which is there?

    The problem with your FIFO implementation is with the add request API MCAN_txBufAddReq(APP_MCAN2_BASEADDR, 1U); - the 1 here in the second argument of the API tells to add transmission request for the TX BUffer #1. But when you have configured the Tx buffers as FIFO then you don't know that is that msg being written to the TX BUffer #1. You need to get that index and then add request for the same.

    So the background is that there are 32 Tx buffers and you can configure them to be either "Dedicated Tx Buffers" or as "Tx FIFO" in case of buffers you write to a particular buffer and add request for the same. ( this is why i wanted you to switch to buffers) 

    In case you use FIFO then before adding request you need to get the FIFO status using the MCAN_getTxFIFOQueStatus(mcanBaseAddr, &txFIFOStatus) API and then use the txFIFOStatus.putIdx as the buffer number to add request for.

    Can you check if you have the Buffer initiallization code in the app? Or is it just the FIFO?

    Regards,

    Karan

  • Hi Karan,

    1. Below MCAN initializations have been in my code

        //OsalRegisterIntrParams_t    intrPrms;
        //HwiP_Handle                 hwiHandle;
        MCAN_InitParams             initParams;
        MCAN_ConfigParams           configParams;
        MCAN_MsgRAMConfigParams     msgRAMConfigParams;
        MCAN_StdMsgIDFilterElement  stdFiltelem;
        MCAN_BitTimingParams        bitTimes;

        /* Register Rx Interrupt */
        //Osal_RegisterInterrupt_initParams(&intrPrms);
        //intrPrms.corepacConfig.arg              = (uintptr_t) NULL;
        //intrPrms.corepacConfig.isrRoutine       = &MCAN2_tx_isr;
        //intrPrms.corepacConfig.priority         = 0U;
        //intrPrms.corepacConfig.corepacEventNum  = 0U;
        //intrPrms.corepacConfig.intVecNum        = APP_MCAN2_RX_INTR;

        //Osal_RegisterInterrupt(&intrPrms, &hwiHandle);

        /* Initialize MCAN Init params */
        initParams.fdMode                       = 0x1U;
        initParams.brsEnable                    = 0x1U;
        initParams.txpEnable                    = 0x0U;
        initParams.efbi                         = 0x0U;
        initParams.pxhddisable                  = 0x0U;
        initParams.darEnable                    = 0x1U;
        initParams.wkupReqEnable                = 0x1U;
        initParams.autoWkupEnable               = 0x1U;
        initParams.emulationEnable              = 0x1U;
        initParams.emulationFAck                = 0x0U;
        initParams.clkStopFAck                  = 0x0U;
        initParams.wdcPreload                   = 0xFFU;
        initParams.tdcEnable                    = 0x1U;
        initParams.tdcConfig.tdcf               = 0xAU;
        initParams.tdcConfig.tdco               = 0x6U;

        /* Initialize MCAN Config params */
        configParams.monEnable                  = 0x0U;
        configParams.asmEnable                  = 0x0U;
        configParams.tsPrescalar                = 0xFU;
        configParams.tsSelect                   = 0x0U;
        configParams.timeoutSelect              = MCAN_TIMEOUT_SELECT_CONT;
        configParams.timeoutPreload             = 0xFFFFU;
        configParams.timeoutCntEnable           = 0x0U;
        configParams.filterConfig.rrfs          = 0x1U;
        configParams.filterConfig.rrfe          = 0x1U;
        configParams.filterConfig.anfe          = 0x1U;
        configParams.filterConfig.anfs          = 0x1U;

        /* Initialize Message RAM Sections Configuration Parameters */
        msgRAMConfigParams.flssa                = APP_MCAN_STD_ID_FILT_START_ADDR;
        msgRAMConfigParams.lss                  = APP_MCAN_STD_ID_FILTER_NUM;
        msgRAMConfigParams.flesa                = APP_MCAN_EXT_ID_FILT_START_ADDR;
        msgRAMConfigParams.lse                  = APP_MCAN_EXT_ID_FILTER_NUM;

        msgRAMConfigParams.txStartAddr          = APP_MCAN_TX_BUFF_START_ADDR;
        msgRAMConfigParams.txBufNum             = APP_MCAN_TX_BUFF_SIZE;
        msgRAMConfigParams.txFIFOSize           = 0U;
        msgRAMConfigParams.txBufMode            = 0U;
        msgRAMConfigParams.txBufElemSize        = MCAN_ELEM_SIZE_64BYTES;
        msgRAMConfigParams.txEventFIFOStartAddr = APP_MCAN_TX_EVENT_START_ADDR;
        msgRAMConfigParams.txEventFIFOSize      = APP_MCAN_TX_BUFF_SIZE;
        msgRAMConfigParams.txEventFIFOWaterMark = 3U;

        msgRAMConfigParams.rxFIFO0startAddr     = APP_MCAN_FIFO_0_START_ADDR;
        msgRAMConfigParams.rxFIFO0size          = APP_MCAN_FIFO_0_NUM;
        msgRAMConfigParams.rxFIFO0waterMark     = 3U;

        msgRAMConfigParams.rxFIFO0OpMode        = 0U;
        msgRAMConfigParams.rxFIFO1startAddr     = APP_MCAN_FIFO_1_START_ADDR;
        msgRAMConfigParams.rxFIFO1size          = APP_MCAN_FIFO_1_NUM;

        msgRAMConfigParams.rxFIFO1waterMark     = 3U;
        msgRAMConfigParams.rxFIFO1OpMode        = 0U;
        msgRAMConfigParams.rxBufStartAddr       = APP_MCAN_RX_BUFF_START_ADDR;
        msgRAMConfigParams.rxBufElemSize        = MCAN_ELEM_SIZE_64BYTES;
        msgRAMConfigParams.rxFIFO0ElemSize      = MCAN_ELEM_SIZE_64BYTES;
        msgRAMConfigParams.rxFIFO1ElemSize      = MCAN_ELEM_SIZE_64BYTES;

        /* Initialize Tx Buffer Config params */
        stdFiltelem.sfid2                       = 0x0U;
        stdFiltelem.sfid1                       = 0x4U;
        stdFiltelem.sfec                        = 0x7U;
        stdFiltelem.sft                         = 0x0U;

        /* Initialize bit timings: 1Mbps and 5Mbps as nominal and data bit-rate respectively */
        bitTimes.nomRatePrescalar               = 0x7U;
        bitTimes.nomTimeSeg1                    = 0x5U;
        bitTimes.nomTimeSeg2                    = 0x2U;
        bitTimes.nomSynchJumpWidth              = 0x0U;
        bitTimes.dataRatePrescalar              = 0x1U;
        bitTimes.dataTimeSeg1                   = 0x3U;
        bitTimes.dataTimeSeg2                   = 0x2U;
        bitTimes.dataSynchJumpWidth             = 0x0U;

    2. Used MCAN_getTxFIFOQueStatus(APP_MCAN2_BASEADDR, &fstat) API with FIFO mode and observed  fstat.putIdx to be equal to "0".

    Observation

    Error frames seen on PC side.

    Kindly let me know some input on the same.

    Regards

    Pooja

  • Hi Karan,

    1. Currently able to transmit messages from board to PC using MCAN2 (mcu2_1) application created in vision_apps/utils taking into pdk loop back example reference.


    2. I have a custom kernel created for DSP core and integrated in vision apps application.


    3. Now I need to send messages from DSP Kernel to MCAN application.


    4. In TDA2x we had used "System_linkControl" API, now in TDA4x which API can be used for the same.


    5. Observed "tivxNodeSendCommand" API used in app_single_cam application to send some address to kernel.

    Kindly suggest any reference application or supporting API for the above purpose.

    Thanks and Regards

    Pooja Krishna

  • Hello Sujith, Karan

    As per the discussion on CAN issue of hanging after certain number of frames, following steps were suggested from your end

    1. Experiment No.1
    -> Sending CAN message of a structure of static 4 bytes data
    -> Observed app hang after ~9000 frames.

    2. Experiment No.2
    -> Sending CAN message of a structure of static 20 bytes size
    -> Observed app hang after ~5000 frames.

    #. Performance measurement wrt experiment no. 2
    -> Performance of APP_mcanTxTest()
    : avg = 234 usecs, min/max = 0 / 403 usecs, #executions = 1685
    -> Performance of appRemoteServiceRun()
    :avg = 543 usecs, min/max = 0 / 662 usecs, #executions = 515

    So issue still exist even if we send only 4 byte data to mcan module, so kindly provide me some input on the same.

    Thanks and Regards

    Pooja Krishna

  • Hi Pooja,

    Can you please connect JTAG and try to identify where is it stuck?

    Regards, Sujith