PWM overflow triggering DMA, DMA sends data to IDAC

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
user_3003661
Level 3
Level 3
10 likes given 5 likes given First like received

Hi,

I'm having problems triggering DMA by PWM overflow signal, and then sending data from a sine wave array in memory to IDAC's register to get a sine wave on IDAC's output pin. I'm using a CY8CKIT-048 PSoC Analog Coprocessor Pioneer Kit.

I can't find any info in documentation on how to set up DMA and IDAC properly, what to do with different trigger types and source/destination types etc.

I checked TRM and every component's documentation, but couldn't find anything useful.

In my case I am trying to get DMA to transfer a single element from a 32-point array in memory to IDAC's register. DMA should be triggered on a PWM overflow signal.

DMA's input trigger type is set to a pulse of unknown width, but it looks like it never gets triggered.

I found a similar project (and a case in forum) made for a different PSoC. and tried modifying the code to run on my device, but I can't get it to work.

quote:

Attached is a wave DAC generation project for P4M. The DMA transfer to IDAC on P4 is tricky, it has to be 2 bytes, with MSB set to 0x07, and LSB is actual IDAC value (so RAM array must be 16-bit instead of 8-bit). This MSB is configuration setting for IDAC, controlling current output/bit, which has to be set on each DMA transaction. The DMA trigger has to be set to "unknown width". Max frequency achievable is lower than for PSoC5, reaching ~13.4 kHz @256 points/waveform, but the DAC output quality is better (no bit flipping glitches). Unlike PSoC5, on P4 DMA has no "nrq" signaling the end of Buffer transfer, instead the DMA internal irq and a PinLED are used to for that purpose.

In DMA_callback i tried blinking an LED, but it doesn't do anything, so I'm assuming it never transfers anything.

This is a part of DMA initialization code i found.

//DMA init

    DMA_1_SetInterruptCallback(&DMA_callback);

    CyIntEnable(CYDMA_INTR_NUMBER);

    CyGlobalIntEnable; /* Enable global interrupts. */

   

    DMA_1_Start(sine_wave, (void *) IDAC7_1_IDAC_CONTROL_PTR);

    DMA_1_SetNumDataElements(0, 32);

I attached my project so you can check it out.

Any help would be appreciated.

Tomislav

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
MiRo_263836
Level 5
Level 5
100 replies posted 50 likes received 50 replies posted

I have a project that does this for the P4200M.  I created an array in RAM that ORs the IDAC control reg with the Sine Wave array in flash and then DMA this to the IDAC conrol reg. It works well.

View solution in original post

8 Replies