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.

Compiler/PROCESSOR-SDK-DRA8X-TDA4X: autosar

Part Number: PROCESSOR-SDK-DRA8X-TDA4X

Tool/software: TI C/C++ Compiler

Hi, experts,

I want to integrate MCUSW/autosar software into the project of vision_apps.

I did the following:

1. copy all MCUSW/autosar source code to the vision_apps/utils and add the concerto.mak.
2. build the autosar software as a library. TARGET := app_utils_autosar TARGETTYPE := library

3. In the vision_app basic_demos add the library for linking.

4. Excute make vision_apps and debug MCU2_1 with CCS. The program is OK.

5. But when I excute make linux_fs_install_sd to copy the binary to the SD card, the MCU2_1 Program can't work correctly.

The MCU2_1 program stop in the function of CanApp_PlatformInit:

-------------------------------------------------
void CanApp_PlatformInit()
{
uint32 regVal = 0U;

printf("CanApp_PlatformInit\n");
/* Unlock lock key registers for Partition 7: IO PAD
configuration registers in MAIN_CTRL_MMR */
/* write Partition 7 Lock Key 0 Register */
CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1D008, 0x68EF3490);
/* write Partition 7 Lock Key 1 Register */
CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1D00C, 0xD172BC5A);
/* Check for unlock */
regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1D008);
while ((regVal & 0x1) != 0x1U)
{
regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1D008);
}
/* Unlocking done */
/* Below code will be replaced by Port module in further releases */
#if defined (BUILD_MCU1_0)
printf("CanApp_PlatformInit MCU1_0\n");
/* MCU MCAN 0 Tx PAD configuration */
regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0A8U);
regVal &= 0U;
regVal |= 0x60000U;
CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0A8U, regVal);
/* MCU MCAN 0 Rx PAD configuration */
regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0ACU);
regVal &= 0U;
regVal |= 0x60000U;
CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0ACU, regVal);
/* MCU MCAN 1 Tx PAD configuration */
regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C0U);
regVal &= 0U;
regVal |= 0x60001U;
CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C0U, regVal);
/* MCU MCAN 1 Rx PAD configuration */
regVal = CSL_REG32_RD(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C4U);
regVal &= 0U;
regVal |= 0x60001U;
CSL_REG32_WR(CSL_WKUP_CTRL_MMR0_CFG0_BASE + 0x1C0C4U, regVal);
#endif //BUILD_MCU1_0

#if defined (BUILD_MCU2_1)
printf("CanApp_PlatformInit MCU2_1\n");
/* fix SDK bug, flynnpeng 2020-5-14 */
/* Unlock lock key registers for Partition 7: IO PAD
configuration registers in MAIN_CTRL_MMR */
/* write Partition 7 Lock Key 0 Register */
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1D008, 0x68EF3490);
/* write Partition 7 Lock Key 1 Register */
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1D00C, 0xD172BC5A);
/* Check for unlock */
regVal = CSL_REG32_RD(CSL_CTRL_MMR0_CFG0_BASE + 0x1D008);
while ((regVal & 0x1) != 0x1U)
{
regVal = CSL_REG32_RD(CSL_CTRL_MMR0_CFG0_BASE + 0x1D008);
}
/* end fix SDK bug, flynnpeng 2020-5-14 */

/* MAIN MCAN 0 Tx PAD configuration */
regVal = 0x60000U;
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C20CU, regVal);
/* MAIN MCAN 0 Rx PAD configuration */
regVal = 0x60000U;
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C208U, regVal);
/* MAIN MCAN 4 Tx PAD configuration */
regVal = 0x60006U;
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C020U, regVal);
/* MAIN MCAN 4 Rx PAD configuration */
regVal = 0x60006U;
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C024U, regVal);
/* MAIN MCAN 9 Tx PAD configuration */
regVal = 0x60006U;
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C0CCU, regVal);
/* MAIN MCAN 9 Rx PAD configuration */
regVal = 0x60006U;
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C0D0U, regVal);
/* MAIN MCAN 11 Tx PAD configuration */
regVal = 0x60006U;
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C11CU, regVal);
/* MAIN MCAN 11 Rx PAD configuration */
regVal = 0x60006U;
CSL_REG32_WR(CSL_CTRL_MMR0_CFG0_BASE + 0x1C120U, regVal);
#endif //BUILD_MCU2_1
/* Take MCAN transceivers out of STB mode i.e NORMAL Mode */
CanApp_EnableTransceivers();
}
---------------------------------

and I can't initialize MCAN controller.

This function can't run correctly:

-----------------------------------------
/** \brief Start up sequence : Program the interrupt muxes / priorities */
void CanApp_Startup(void)
{
/* Equivalent to EcuM_AL_SetProgrammableInterrupts */
CanApp_BuildIntList();

CanApp_InterruptConfig();

/* Initialize counters, that would be required for timed operations */
// AppUtils_ProfileInit(0);

CanApp_PowerAndClkSrc();

/* Initialize dummy CAN IF */
CanIf_Init(NULL);
}
-------------------------------
so, I have some questions about TDA4X.

1. When I use uboot to load the mcu program, can the MCU set related hardware registers, or must it be set on the Linux side.
2. How can I debug MCU program when I boot mcu program with U-boot.

3. The limitation of boot MCU program with u-boot. Why I can run my MCU program with CSS but U-BOOT can't run correctly.

autosar SDK Path as follow:  sdk path/vision_apps/utils/autosar

mcu2_5F00_1.tar.gz SDK path as follow: sdk_path/vision_apps/apps/basic_demos/app_tirtos/tirtos_linux/mcu2_1

Thanks. 

  • This is my autosar file

    autosar.tar.gz SDK Path as follow: sdk path/vision_apps/utils/autosar

  • Hi,

    -1-

    I'll start with the easy part, why it doesn't work:

    So we have examples which we can support as standalone examples.These standalone examples are designed to demonstrate the IP features and functionality more so than the overall integration. So these examples may be designed with the idea that no resource is restricted to use, this make these examples easier for customers to understand and focus on the key IP feature.

    These examples will work out of the box with the SBL and CCS boot mode.

    When you take the existing standalone examples try to integrate it with the others (like linux in this case), the things which didn't matter in -1- start to play a role. When you use u-boot to load the application along with linux the application could have some resource (pinmux, clock, etc) conflict with linux and might fail to load.

    -2-

    Now coming to the tricky part:

    user5354548 said:
    When I use uboot to load the mcu program, can the MCU set related hardware registers, or must it be set on the Linux side.

    Not necessarily, we can set registers anywhere as long as they are not firewalled (by sysfw) or are among the conflicting resource. If the resource (here register) is needed by both the autosar app and linux, one needs to leave it.

    user5354548 said:
    How can I debug MCU program when I boot mcu program with U-boot.

    I need to check get back on this.

    user5354548 said:
    The limitation of boot MCU program with u-boot. Why I can run my MCU program with CSS but U-BOOT can't run correctly

    Explained in -1-

    Regards,

    Karan


  • Thanks Karan,

    I have a idea, If I boot my system with SBL, Can I develop Linux and R5F programs separately.

    For example, I develop my R5F and DSP program, and boot my Linux system with SBL.

  • Hi,

    Apologies for a late reply.

    So if I understand correctly, your target is to run an mcusw demo along with linux. You want to load the mcusw demo from u-boot?

    If this is what you want then in some recent debug I have been able to run the CAN application on MCU R50_0 by loading from u-boot. (this is on SDK 6.02, please confirm you SDK version).

    I can send out a patch for the modification you need if that helps.

    Please let me know.

    Regards,

    Karan

  • You are right.

    I want load my R5F0_0 program with u-boot, at the same time, R5F0_0 can communitation with main domain MCAN0 ~ MCAN 11.

    Thank you.

  • Hi,

    So what I had done as a part of the other debug was to run the can_profile_app http://downloads.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/mcusw/mcal_drv/docs/drv_docs/demo_can_profile_top.html on the MCU R5F0_0 and load from u-boot/R5 SPL.

    But this misses one of your requirement, the application while running on MCU R5F0_0 only exercises the 2 MCAN instances in the MCU domain, not the ones on the MAIN domain. Please can you refer to https://e2e.ti.com/support/processors/f/791/p/903161/3351147#3351147

    But as there have been some customers wanting what you require, I'm planning to spend some time on what you need exactly - i.e. the above + MAIN domain MCANs. This is planned after a couple of weeks but, let me know if this timeline or what was done in the thread I mentioned above works for you and then we can go from there.

    Regards,

    Karan

  • Thans, Karan,

    Waiting for new version.
  • Hi,

    I was able to get the CAN application working as a firmware from u-boot. But you would need to use a GESI daughter card for that. Do you have one? If yes I can provide you with some patches. If you don't have one still you will be able to run in internal loopback mode.

    Also please confirm that you are on the latest SDK 6.02.

    Regards,

    Karan

  • Hi Karan,

       I have a GESI daughter card and my SDK version is 6.02. I need your patch. 

    Thank you very much.

  • Hi,

    Please find the attached patch set./cfs-file/__key/communityserver-discussions-components-files/791/can_5F00_demo.7z

    The patches need to be applied to the mcusw/ directory.

    Do the following to apply patches:

    cd <SDK_INSTALL_PATH>/mcusw/
    git init
    git add .
    git commit -s #commit changes
    git am <PATH_TO_PATCHES> 000*
    
    #Apply all 5 patches

    The patches are still not in a clean state and once you are able to reproduce my setup I can explain what all the patches do and why were they needed.

    Application right now can be loaded from u-boot referring to - https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-jacinto7/latest/exports/docs/linux/Foundational_Components_U-Boot.html#remoteproc

    The core you want to load is core_id = 3 (mcu2_1)

    The application which you'll build after you apply the patches is a Tx only application which will transmit 50000 messages from the MCAN 11 interface. So you need to have some emulator receiving those messages. If you connect an emulator to MCAN11 (configured for correct data and nominal bit rate as well as the sampling point) then you will see 50000 messages received.

    The application has prints UART prints disabled as the UART instance conflicts with Linux UART hence it won't print anything. It will print to CCS although (if you have it connected).

    I know it is a lot of information (with not a lot of explanation) so please feel free to ask for more in case it is not very clear.

    Regards,

    Karan