TMS320F28P650DK: Same MotorControl SDK code works on CPU1 but not on CPU2 – TMS320F28P650DK6

Part Number: TMS320F28P650DK

Hello TI Team,

I am working on a dual-CPU application using the TMS320F28P650DK6 MCU and the TI C2000 MotorControl SDK.

I have a MotorControl SDK application that runs correctly when executed on CPU1, but the same application does not behave correctly when executed on CPU2.

MCU / Software

  • MCU: TMS320F28P650DK6

  • Software: TI C2000 MotorControl SDK

  • IDE: Code Composer Studio

  • CPU1 + CPU2 dual-core application

  • Motor-control application using ePWM, ADC, and control ISR

  • Both CPUs are configured with the required peripheral clocks.

What I have observed

The same motor-control code works correctly on CPU1.

When I move/run the same control application on CPU2, the motor-control behavior is different.

For example, at approximately 20 Hz speed reference:

Parameter CPU1 CPU2
Speed reference ~20 Hz ~20 Hz
DC bus voltage ~42 V ~42 V
speed_Hz feedback ~21.19 Hz ~0.0388 Hz

Therefore, the CPU2 application is executing, but the motor-control feedback/control behavior is not equivalent to CPU1.

CPU1 / CPU2 clock observation

I compared the CPU1 and CPU2 device.h and device.c configurations.

Both CPUs are configured for:

  • 20 MHz XTAL

  • 200 MHz SYSCLK

  • 50 MHz LSPCLK

The CPU1 code boots CPU2 using Device_bootCPU2().

I also tested a simple LED toggle on both CPUs.

The LEDs do not turn ON/OFF at exactly the same instant, but the time offset remains approximately constant for every cycle.

Therefore, I believe this is primarily a startup/phase offset rather than a continuously accumulating CPU clock-frequency difference.

Peripheral configuration

I have enabled/configured the peripherals required by the CPU2 application, including the peripherals used by the MotorControl SDK application.

The Device_enableAllPeripherals() implementation is also present on CPU2.

I have therefore not intentionally left the required ePWM/ADC/peripheral clock disabled on CPU2.

CPU2 boot sequence

CPU1 releases CPU2 from reset using:

void Device_bootCPU2(uint32_t bootmode)
{
    IPC_setBootMode(IPC_CPU1_L_CPU2_R,
                    (BOOT_KEY | bootmode));

    IPC_setFlagLtoR(IPC_CPU1_L_CPU2_R, IPC_FLAG0);

    SysCtl_controlCPU2Reset(SYSCTL_CORE_DEACTIVE);

    while(SysCtl_isCPU2Reset() == 0x1U);
}

CPU2 successfully starts executing code, so CPU2 is not simply remaining in reset.

My main question

What are the CPU1-specific dependencies in the TI C2000 MotorControl SDK that could cause the same motor-control application to work on CPU1 but behave differently when executed on CPU2?

In particular, could you please advise what I should check regarding:

  1. ePWM ownership between CPU1 and CPU2

  2. ADC ownership/configuration

  3. ePWM → ADC SOC synchronization

  4. CPU2 interrupt configuration and vector table

  5. Motor-control ISR execution rate

  6. CPU timer / system clock dependencies

  7. CLA or other accelerator dependencies

  8. Shared RAM / MSGRAM / IPC configuration

  9. Peripheral access or ownership restrictions between CPU1 and CPU2

  10. Any MotorControl SDK modules that assume execution on CPU1

  11. Any CPU1-specific initialization required before the MotorControl SDK can run on CPU2

  12. Whether ePWM time-base synchronization needs to be explicitly configured between CPU1 and CPU2

Additional question about CPU synchronization

Since CPU2 is released from reset by CPU1, should I expect a fixed phase offset between CPU1 and CPU2 execution?

If so, is there any recommended TI mechanism for synchronizing the motor-control timing/ISR between CPU1 and CPU2, rather than simply synchronizing the software startup?

I can provide the complete CPU1 and CPU2 project files, linker command files, device.c/.h, ePWM/ADC configuration, and MotorControl SDK source if required.

I would particularly appreciate guidance on how to identify why the MotorControl SDK control loop produces correct speed feedback on CPU1 but almost zero speed feedback on CPU2.

Thank you.

  • Hi Ajay,

    Which estimator are you using in your design? If you are using FAST, you may try to switch to ESMO since the source is open and this may be easier to debug on your side. For the other points, please allow me some time to prepare a response

    Regards,

    Peter

  • Hi Peter,

    Thank you for your response.

    In our current design, we are not using FAST or eSMO. We are using an incremental encoder for rotor position feedback and implementing sensored FOC.

    The encoder is used for position and speed feedback, and our main concern is related to the position control/position loop behavior.

    Thank you for taking the time to look into the other points. We will wait for your detailed response.

    Regards,
    Ajay

  • Hi Ajay,

    Thanks for the additional information this is very helpful. Since you are using incremental encoder and own all the source for the sensored FOC, I don't believe the issue is with any library files/binaries. Can you verify and ensure that all C2000 peripherals that are present on your project also function properly when owned by CPU2? For example, since you are using incremental encoder, please check that EQEP counter is properly incrementing by examing the EQEP registers. Your ADC readings also look to be correct since there are no differences in the sensed DC bus voltage, but please sure to verify all other analog inputs to ensure proper sensing.

    Regards,

    Peter