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.

TMS570LC4357: Use DMA to generate waveform through PWM

Part Number: TMS570LC4357

Tool/software:

Dear Dirs.

I want to generate a 10kHz sinewave using the Hercules processor and get the ADC sampling a feedback signal.

The approach that I'm trying is using the DMA to reload the PWM module with a Look-Up-Table that contains the sinewave.

At the same time, when the DMA ends the transactions (one full waveform), I'd like to trigger an ADC conversion.

I'm failing at the first stage, not able to get the DMA work. Can somebody help?

Thank you.

  • Hi Txema,

    We can generate block transfer complete interrupt using DMA after a block of data transfer.

    You can refer below example once:

    0434.DMA_Memory_to_Memory_Transfer_RM57.zip

    In above example i am doing a block of data memory to memory transfer, and after doing memory to memory transfer i configured to generate one block transfer interrupt. In that block transfer interrupt i am again triggering the transfer. I hope this would be useful for you.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    than you for your prompt answer. I guess I may have given too many details in my question and somehow "diluted" my biggest challenge with the intention to provide a more overall context of what I'm trying to do.

    My biggest challenge is not so much setting up a DMA channel or getting the interrupt once it's done with the transfer.

    What I don't get working is the PWM module requesting a new value to be loaded into the CMPA comparison register every time the PWM period is over.

    This is what I have tried so far:

    /* Enable DMA */
    dmaEnable();

    dmaEnableInterrupt(DMA_CH0, BTC, DMA_INTA); /* DMA_CH0 is highest priority */
    dmaReqAssign(DMA_CH0, 42); /* Ch 42 in PWM6 SOCA */

    While I have "Enable the ADC SOCA" checked and SOCASEL set to "CTR_PRD". I'm assuming that SOCA is the same as the one stated in the Programming Manual "SCI4 receive / ePWM6_SOCA / MIBSPI2[12] / MIBSPI4[12] / GIOB[2]"

  • OK, I got stuck at this point with no answer from the community.

    I found a solution that I want to share, in case somebody else is interested: Instead of using PWM and DMA, use HET and HTU.