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.

CCS/TMS320F28377D: ePWM TBPRD register resets

Part Number: TMS320F28377D

Tool/software: Code Composer Studio

I have ePwms 1 and 2 routed out through GPIOs as control signals and ePwms 5, 6, and 9 to provide interrupt triggers.

I tried to add ePwms 3 and 4 as additional GPIOs. The program compiled and starts but now all of the TBPRDs have reset to 0 and thus none of the PWMs are functioning. I have stepped through the code line-by-line and confirmed that each ePwm has the correct TBPRD loaded initially but it is during the while(1) loop in main that they get reset to 0 and I am unable to track the issue further.

I am able to comment out the ePwms 1 and 2 setup to get ePwms 3, 4, 5, 6, and 9 to work correctly, but I am unable to get all 7 functioning simultaneously. I have played around with optimization options with no luck. Any thoughts?

Thanks,
Eric

  • Hi Eric,

    I would suggest posting your main C file and your PWM initialization routines. Have you tried using breakpoints to determine when the TBPRD is reset? Note that you may see different behavior using breakpoints or run to line than when you use single stepping. Run to line or breakpoints are more similar to run time.

    Regards,
    Kris
  • I set a breakpoint to after the pwm init functions were called and confirmed via CCS that the TBPRDs were all set correctly. When stepping through, it seems that the TBPRDs get reset after the CLA force function calls. I traced down the issue to the fact that I had a for loop in my CLA task that looked like this:

    __interrupt void Cla1Task1 (void)
    {
    	unsigned int i;
    
    	for (i=0;i<nfreqs;i++)
    	{
    		phase[i] = phase_init[i];
    	}
    }

    where nfreqs was defined as an int. For some reason, it compiles and often runs without an issue, but when I tried to add more PWMs, this would cause all TBPRDs to reset. Changing nfreqs to a type uint8_t seemed to fix the issue... Any thoughts on how the CLA could impact the PWM regs?

  • It is not clear as to how this would have solved the issue.

    Can you tell me the memory location of nfreqs in both cases (int, uint8_t).

    Regards,
    sal