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/TMS320F28335: A problem on the initialization of EPWM modules

Part Number: TMS320F28335
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

Hello, experts from TI:

    I met a strange problem when using F28335 as MCU of a Motor drive system. My program is almost the same as the example project “HVPM_Sensorless_2833x” in the controlsuite. The only modification is on the initialization of EPWM modules.

    According to the 2833x EPWM reference guide, the proper initialization procedure of EPWM modules should be as follows:

1. Enable ePWM module clocks in the PCLKCRx register

2. Set TBCLKSYNC= 0

3. Configure ePWM modules

4. Set TBCLKSYNC=1

    However, it turned out that the system cannot enter the ISR (triggered by EPWM) when original initialization codes were modified accordingly. The modification is as follows:

 

    When I commented out the added lines, the system works properly again, this indicated that other codes and the hardware system are OK.

    Through several trials I found that the configurations in the PWM_INIT_MACRO(1,2,3,pwm1) macro didn’t effect with initialization codes above, e.g.:

    Strangely, I found in the 2833x example project named “epwm_timer_interrupts” that the initialization codes resemble well with my modifications, and this project can work well on the same control board: the ISR counter kept increasing.

    Can you please enlighten me the cause of this problem and any possible solution? Thank U in advance.

Best Regards.

  • Almark,

    what your doing is to ensure that you start all ePWM clocks at the same time. For this reason it should be wrapped around all of the ePWM's setup code. It is not a hard requirement if you are OK with the PWMs starting at a slightly different time.

    Now for the error you are seeing: I suspect that the EALLOW bit was already enabled before this section of code. So when you made your modifications correctly enabling and disabling EALLOW access some code later on was unable to correctly execute. 

    To confirm my theory try removing both "EDIS" lines and debugging your code again.

    Regards,
    Cody 

  • Did this solve you issue? This thread will be closing soon.

    Regards,
    Cody