AnsweredAssumed Answered

Update PWM duty cycle with DMA

Question asked by antoniomagrì on Nov 12, 2014
Latest reply on Dec 16, 2014 by Adrian Cano

Hello everyone,

 

I am new to Kinetis microcontrollers and Kinetis SDK development, I own a TWR-KV31120M board and I am trying to set a project up in KDS using SDK and PE.

 

I was able to create a PWM output and change its duty cycle in software, but I am now trying to update the value from RAM using DMA.

 

I created and configured a fsl_edma component:

 

config.png
This led to the generation of initialization code for DMA, which initializes DMA, requests a channel, and installs a callback function.

 

If I understand correctly now it's up to me to configure the loop with EDMA_DRV_ConfigLoopTransfer and start it with EDMA_DRV_StartChannel.

 

I am trying to have the content of a 16-bit variable, pwmduty, to the TPM0_C0V register (also 16-bit).

 

This is the way I am doing the calls to the functions:

 

 

if (EDMA_DRV_ConfigLoopTransfer(&dmaController1_ChnState0,&descriptor,

                                                       kEDMAMemoryToPeripheral,

                                                       (uint32_t)&pwm_duty,

                                                       (uint32_t)&FTM0_C0V,

                                                       2,

                                                       2,

                                                       2,

                                                       0

     ) == kStatus_EDMA_Success) {

 

     EDMA_DRV_StartChannel(&dmaController1_ChnState0);

}

 

While the code above is executed (and the first call returns success) I placed a breakpoint on the callback function and never see it called in debug...

 

Do you know what am I doing wrong?

 

Thank you very much for any suggestion you may have.

 

Best regards,

 

Antonio

Outcomes