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.

TMS320F28388D: Loading Matlab/Simulink generated CPU1 *.out file when debugging CM core

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Hello there,

I'm working on a project with F28388D where applications for CPU1 and CPU2 are developed in Matlab/Simulink (C2000 Support Package), and the CM application in CCS (v11.1.0) with C code.

For testing I first created a small application in CCS for CPU1, which just configures GPIO for the CM and then keeps blinking an LED. I made a Debug Configuration to load and run this application together with the CM application and this works fine.

I also created a small CPU1 application in Simulink (blinking LED), and when using "Build & deploy" in Simulink it runs fine on the target.

Then in the CCS Debug Configuration I changed the CPU1 program to the *.out file that was generated by Simulink. Unfortunately this doesn't work. After starting CPU1 the status shows "(Running - A Reset Occurred On The Target)", and the CM status shows "(In Reset)".

How can I make this work? Are there any more Debug Configuration settings I need to change? It is quite essential for further development that I'm able to load and run the Simulink applications on CPU1 and CPU2 while debugging the M4 CM in CCS.

Thanks and kind regards,
Arjan

  • Hi Arjan,

    We'll get to you in 1-2 days.

    Regards,

    Vivek Singh

  • Hi Vivek,

    I found the cause of the problem. The C2000WARE CM example applications and driverlib_cm all assume a CM clock frequency of 125 MHz, and Aux PLL as the clock source.

    However in the Hardware Configuration of the Simulink CPU1 application (using Embedded Coder Support Package for C2000), the CM clock source can only be set to 'System PLL', and then the resulting CM clock frequency is 100 MHz.

    After changing CM_CLK_FREQ to 100000000U in my CM application it is working OK. I can load the Simulink-generated CPU1 *.out file, and I can debug the CM application in CCS.

    Kind regards,
    Arjan

  • Hi Arjan,

    Are you using EtherCAT on the CM by any chance? If yes, how did you manage to Setup EtherCAT GPIOs, Allocate Ethercat to CM and release the CM from CPU1 simulink.

    Thank you

  • Hi Alexis,

    I'm not using EtherCAT, however in general Matlab/Simulink uses IPC messages to CPU1 for configuring GPIO. If you create a model for CM that uses GPIO and generate C code, then you will see function calls to MW_IPC_sendCommand().

    For example, this is the code for configuring the EtherCAT Run LED GPIO on the F28388D ControlCard:

        /* LED4 (EtherCAT run) on F28388D ControlCard */
        gpioConfigCmd = 0x00010000 | DEVICE_GPIO_PIN_LED4;
        MW_IPC_sendCommand( IPC_CM_L_CPU1_R, (IPC_FLAG0 | IPC_FLAG31),
                            IPC_ADDR_CORRECTION_ENABLE, IPC_FUNC_CALL,
                            (uint32_t)&cmMsgRam[0], gpioConfigCmd );
        IPC_waitForAck( IPC_CM_L_CPU1_R, IPC_FLAG31 );
        IPC_getResponse( IPC_CM_L_CPU1_R );

    You can include the C2000 Support Package C code (c2838xM4Board_Realtime_Support.c, MW_cmIPC.c, etc.) in your CCS project, and then you are able to use those IPC functions.

    Hope this helps!
    Kind regards,
    Arjan

  • Thank you very much Arjan, I will give a try.

    But I am still puzzled, I don't see an easy way to release the CM from reset. Normally the CPU1 is doing it (configureAndReleaseCMToWait(void), releaseCMToApplication(void)). In your case if you are using the CM in debug mode I guess it releases the CM manually.

  • Expectation is that user will always run CPU1 application before CM and CPU1 application will release CM (and CPU2) out of reset. You can also have CPU1 Gel file release reset for CM if using CCS.

    Regards,

    Vivek Singh 

  • Hi Vivek,

    I basically want to know if it will be feasible to have the EtherCAT connectivity on the CM, run Simulink on CPU1 and 2 and send data via simulink to CM using IPC.

  • I have not used Simulink so let me check with some other expert on this.

    Regards,

    Vivek Singh

  • Thank you Vivek, let me know if you want me to create a new post.

  • Hi Alexis,

    If you could create a new post, that will be great. Thank you.

    Regards,

    Vivek Singh