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.

TMS320F28379D: DMA transfer to set CMPA,CMPB of multiple PWMs

Expert 1570 points
Part Number: TMS320F28379D

Hi,

I need to set the CMPA/B of 3 PWM modules (1,2,3).

Is there a way to configure a single DMA channel to write CMPA/B values to these 3 modules, even though the addresses are not consecutive?

I thought to define 1 burst and 3 transfers, and maybe there's a way to define a "jump" in the addresses between transfers?

If not, I guess the only way is to configure 3 different DMA channels?

Thanks!

  • Mojo,

    This should be possible.  I'm assuming you need to write CMPA/B of PWM1, then CMPA/B PWM2, finally CMPA/B of PWM3. 

    CMPA/B are consecutive addresses in each PWM, so you can just make the BURST Step +1, 4 16 bit writes( or 2 16 bit writes if you are not using the HR portion of the CMPA/B register you'll need to make the BURST Step +2 ). 

    You will then want do this 2 more times; so we can use the transfer count and steps for this.  Transfer size of 2(this will do 3 total DMA BURSTs) and then use the destination transfer step to increment into the PWM2 address space.  The burst size/step from before will take care of the rest.

    If you are writing the same values across all the PWMs, you could use the source transfer step to backtrack or if there are 6 different values you could move forward in that array to write the correct value on each PWM.

    Lastly, you want this all to happen with a single trigger so you want to enable ONESHOT mode in the DMA.

    Let me know if you have any issues, and we can go from there.

    Best,
    Matthew

  • Thank you!

    it works perfectly