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/TMS320F28379D: interrupt adc or epwm

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi,

Thank you for your time. 

I am using an ADC interrupt to collect external voltage, from which I calculate the CMPA value by designing a controller through 28379D launchpad. Initially, I implemented ADC interrupt and PWM interrupts by two separate programmes. The ADC programme accurately measured the data with some desired calculation. Similarly, the PWM programme generates the output through PWM1,2,3 with variable switching cycle. But when, I combined the two programme into one with ADC interrupt, though the measurement comes correctly with ADC results, I don't get any PWM output. My task was to calculate the duty from ADC input and to use it as compare variable in PWM

 

    combine - Copy.docx

. Please suggest me in this regard. For reference, I am attaching an overview of the programme.

Thank you

  • Hi,

    What you are attempting is a very common usage mode.
    You can refer to example
    C:\ti\c2000\C2000Ware_3_01_00_00\driverlib\f2837xs\examples\cpu1\adc\adc_ex2_soc_epwm.c
    Also, most system examples in MotorCOntrolSDK or DigitalPowerSDK use similar configuration as well.
    Make sure your PWMs are configured in shadow mode such that the CMPA values are reflected on the following PWM cycle.

  • Thank you very much for your reply.

    I have gone through the example file earlier. But I doubt I m doing some mistake with PIEIER3 with yellow highlighted portion while using PWM interrupt. Since I am using EPWM4 to start SOC for the ADC unit, should I have to change it? Similarly next to it, I have declared about group1 interrupts IER, whether I have to change it to group3. More specifically I want a clear understanding of the below-mentioned command lines.

    PieVectTable.ADCA1_INT = &adca1_isr; //function for ADCA interrupt 1
    //PieVectTable.EPWM1_INT = &epwm_isr; ..................should it be 4th interrupt

    //enable PIE interrupt
    PieCtrlRegs.PIEIER1.bit.INTx1 = 1;
    //PieCtrlRegs.PIEIER3.bit.INTx1 = 1;....................... whether this needs to be changed??
    //Enable global Interrupts and higher priority real-time debug events:
    IER |= M_INT1; //Enable group 1 interrupts
    // IER |= M_INT3;
    EINT; // Enable Global interrupt INTM
    ERTM; // Enable

    It would be nice if someone please elaborate on this.

    thank you

  • Hi,

    You could use either interrupt group, I do not think that will stop PWM output generation.
    Is your code entering ISR?


  • Thank you for your valuable suggestion.

    I suppose I haven't stated my problems correctly. After changing either of the interrupts, the PWM control till yet I haven't achieved. Though the problem seems to be simpler for the experts, the solution and understanding are vital for me.

    As initially mentioned, adc works correctly with ADC1 interrupts, similar to the case of EPWM controller, where I have used group3 interrupts. But as a combined program, I have used only adc isr where the initialization is made through EPWM4. The PWM outputs are expected from EPWM1,2,3. But to my wonder, i am not getting PWM outputs, which needs to be evaluated from ADC. 

    My program is definitely entering ISR, otherwise, how could I get ADC response and controller updates. My problem still remains unclear about PWM, which needs to be calculated from controller output inside ADC_ISR. For reference, initially, I have uploaded my program overview also.

    I expect a positive reply from your side.

    Thank you for your precious time.

  • Hi,

    I do not see any dependency w.r.t. PWM operation from using a specific interrupt.
    I can suggest below for progressing with your debug and identifying what is causing the issue.

    • You can check the values of the PWM registers, CMPA/B, TBCTR etc. in the debug window and check if they are getting updated.
    • You can also manually change the values in the debug window to make sure the PWMs are generated
    • Further, you can single step your code to make sure initialization of the PWM modules is happening as expected.

    Clearly, some where the software configuration is not happening as expected. you can single step through the code and figure it out.
    First thing to check would be the PWM register values, if they are all configured to the values you've written. If not, there could be something wrong in the initialization. 

  • Thank you for your suggestion and valuable time.

    I found the error after a thorough revision of the whole program.

    Thank you