DMA to Control Register Question

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

cross mob
Anonymous
Not applicable

Hello,

   

I have a quick question on DMA to Control Register setup. I've gone through the "Getting Started with DMA" guide, and there is certainly a lot to take in.

   

What I'm trying to do, mostly for the sake of understanding DMA usage within PSoC 3, is use a pushbutton which requests a DMA update from SRAM (let's assume there's "myVar", a uint8 variable which holds the data) to the value of an 8 bit control register. That is, "myVar"'s value is written via DMA to a control register upon a button press.

   

Based on my reading of the documents, I feel (and please correct me if I'm wrong) this can be accomplished by using a level (or edge) sensitive 'drq'. But I'm a little stuck on how to proceed from here (or maybe it's the lack of coffee) in code.

   

You guys at Cypress have, in my opinion, great reference documents for this platform (though I usually find that the most useful ones are the hardest to find!), and I am wondering if anyone can provide some guidance/point me to an app note that addresses my simple use case. Most of the examples seem to use arrays and multi-byte bursts. 

   

I've included some relevant DMA code, which does not update the control register in hardware, and if anyone's up to the challenge of looking it over for blatant errors, your feedback would be much appreciated.

   

Thanks, and looking forward to figuring out how to harness the true power of this platform,

   
   

Some snippets of attempted code:

   
//Globally declared  uint8 myVar = 0u;   #define do_dma_BYTES_PER_BURST 1  #define do_dma_REQUEST_PER_BURST 1  #define do_dma_SRC_BASE (CYDEV_SRAM_BASE)  #define do_dma_DST_BASE (CYDEV_PERIPH_BASE)  //Snippets pulled from int main()  do_dma_Chan = do_dma_DmaInitialize(do_dma_BYTES_PER_BURST, do_dma_REQUEST_PER_BURST,     HI16(do_dma_SRC_BASE), HI16(do_dma_DST_BASE));  do_dma_TD[0] = CyDmaTdAllocate();  CyDmaTdSetConfiguration(do_dma_TD[0], 1, CY_DMA_DISABLE_TD, 0);  CyDmaTdSetAddress(do_dma_TD[0], LO16((uint32)&myVar), LO16((uint32)Control_Reg_1_Control_PTR));  CyDmaChSetInitialTd(do_dma_Chan, do_dma_TD[0]);  CyDmaChEnable(do_dma_Chan, 1);   
0 Likes
2 Replies