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/LAUNCHXL-F28069M:

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

i want to update compare register value. in this example they have updated compare register value for all 3 ePWM module in just one function . but i want to update my new value to compare register value in this example. a modified code by me u can see. what should write to update all 3 ePWM module compare value as they have written? in yellow color i have modified code. i have called this function for all three ePWM module.

void update_compare(EPWM_INFO *epwm_info, Uint16 REF_H, Uint16 TIMER_PRD)
{

Uint16 CMPA1;
Uint16 CMPB1;

CMPA1 = REF_H+TIMER_PRD/2; 
CMPB1 = -CMPA1;
EPwm_Regs.CMPA.half.CMPA = CMPA1; //at this point what should i write instead of EPwm_Regs??
EPwm_Regs.CMPB=CMPA1;
/*


if(epwm_info->EPwmTimerIntCount == 10)
{
epwm_info->EPwmTimerIntCount = 0;


if(epwm_info->EPwm_CMPA_Direction == EPWM_CMP_UP)
{
if(epwm_info->EPwmRegHandle->CMPA.half.CMPA <
epwm_info->EPwmMaxCMPA)
{
epwm_info->EPwmRegHandle->CMPA.half.CMPA++;

i tried with just writing EPwmRegHandle.CMPA.half.CMPA=CMP1 & EPwmRegs.CMPA.half.CMPA=CMPA1 & epwm_info->EPwmRegHandle->CMPA.half.CMPA=CMPA1;but it is not working.

  • The "EPWM_info" is just a struct enabling you to more easily programmatically update each PWM. You must define the address of "EPWM_info". To help understnad this I would suggest looking up what a "STRUCT" is and how to use it.

    If that is unclear you can get rid of the structs all together and simply write it like the following: EPwm1Regs.CMPA.half.CMPA = xyzVarible;

    Good luck,
    Cody 

  • hello Cody Watkins, 

    i have done it with as you have said by separating all functions. and it works fine for me. another problem I'm facing is that while doing manual debugging by adding breakpoint to __interrupt void epwm1_isr(void). the code written under this is not executed. same for all 3 ePWM module. so that code written on ISR is not executing. can you spot mistakes in the code?

  • I don't see anything wrong there.

    If you can enter the ISR once, but never again then you have not correctly acknowledged the interrupt.

    If you never enter the interrupt there could be a number of things going on. Check if your PIE vector table is setup correctly. Ensure it points to the correct function.

    Check that the IER/IFR flags are getting set. 

    Ensure that all of the interrupt gates discussed in the PIE section of the TRM are enabling the interrupts to pass.

    If you're completely lost it may be a good idea to start from some simple interrupt based example from C2000Ware.


    Regards,
    Cody