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: Writing DAC output registers via DMA

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hello Everybody,

I am using the launchpad for MCU TMS320f28379D trying to generate a sinusoidal waveform with DAC.

Everything works fine if I cyclically write the output value into the DAC register like this: DacbRegs.DACVALS.all = outVal.

Instead, I am having troubles accessing DAC output registers through DMA. With DMA in fact, I can easily transfer data from RAM to RAM or from ADC to RAM, but not from RAM to DAC. Is there anything particular to do to achieve that? Here the piece of code: DmaRegs.CH2.DST_ADDR_SHADOW = (Uint32)&DacbRegs.DACVALS.all. What happens is that the DAC register does not get accessed at all, even though the DMA "End of Transfer" Interrupt is triggered correctly.

I am sure that DMA settings are OK because if I only change the destination address as DmaRegs.CH2.DST_ADDR_SHADOW = (Uint32)&myRAMvariable it works perfectly.

Can anybody please confirm that DMA can access DAC registers? If yes, how can I do that?

Thank you very much,

Michel

  • Hi Michael,

    There is a C2000ware example that shows exactly what you are trying to do. Please see buffdac_sine_dma.

    A couple of suggestions. 

    1. Have you set the CPUx.SECMSEL bit to allow the DMA access to the peripheral bus (which includes DAC)? You can read more about this in the DMA chapter of the device technical reference manual.

    2. What is the trigger you are using for the DMA channel? The DAC doesn't generate a DMA trigger itself, therefore the DMA must be triggered from another source, e.g. timer or PWM. 

    3. On the DAC registers, are you setting the LOADMODE = 0 such that the DACVALA register is loaded immediately? 

  • Hi Gus,

    Points 2 and 3 were ok from the beginning. What I really missed is point 1!

    Now I set CpuSysRegs.SECMSEL.bit.PF1SEL = 1 and it works! I'll take a look anyway at the example you mentioned for curiosity.

    I read several time the chapter about DMA, but sincerely I did not understand the paragraph about the CLA/DMA arbitration... now it's clear!

    Thus, thank you very much for your precious help, I was getting crazy after this apparently easy thing.

    Regards,

    Michel