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.

how can update CMPA/CMPB ePWM in f28335 DSP ?

Other Parts Discussed in Thread: CONTROLSUITE

hi

I am using up down mode counter. For CMPA, I am using SIN wave and CMPB has two different counter values  are used (i.e. for positive half and negative half of SIN wave has different CMPB values) how can i update ePWM.......

Regards,

Anish

  • Anish,

    On F28335 the action qualifier is not shadowed, so you will have to write the new CMPB settings from within an ISR aligned with the PWM pattern. One example is shown in the attached timing diagram. In this case a periodic interrupt is triggered by a zero match. The ISR would have to calculate which half-cycle you are in and set CMPB to the new value if necessaty. The "Td" time is the delay between the interrupt trigger and the CMPB register update. You'll have to ensure that the new CMPB value is written before the counter passes it, or the event will be missed that PWM cycle.


    Newer devices (F2837x) shadow the AQ registers so doing this is a little easier.

    Regards,

    Richard

    PWM example 1.pdf

  • Thank you for quick reply,
    Sir, my SIN wave is changing every time how can update with the conjunction of the ISR. Please discuss with the help of code so that, this will help me understand better....
    Regards,
    Anish
  • Anish,

    Your ISR will have to compute the new CMPB value each time.  I don't know exactly what you are doing so I can't really recommend any code examples.

    If you haven't already done so I recommend browsing through the development kits and code examples in controlSUITE.  There is a lot of material there and I'm confident you will find something close.  Feel free to post back with more information about what you're doing if you don't find anything useful. 

    Regards,

    Richard

  • Richard Sir,
    when I used only SIN wave as CMPA and one fixed value CMPB then it if fine, I am able to do it,.. its working. But when I am using two different CMPB such as for positive half of SIN has different CMPB and negative has another CMPB than its not updated.
    I search it but not find any helps from controlSUITE. If you have any link than please provide.
    If you provide mail id I can send the code to you..

    Thanks and Regards,

    Anish