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
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

First consideration is button debounced ? If not you could get some strange

   

behavior. Also generally speaking ISR should occur once for a button press,

   

so it should be bounced in > bounced out > DMA trigger. Edge triggered.

   

 

   

You might consider posting project so all settings/configs can be looked at.

   

 

   

Some useful docs -

   

 

   

http://www.cypress.com/documentation/application-notes/an52705-psoc-3-and-psoc-5lp-getting-started-d...                                             AN52705     Getting Started with DMA

   

http://www.cypress.com/documentation/application-notes/an84810-psoc-3-and-psoc-5lp-advanced-dma-topi...                          AN84810     PSoC® 3 and PSoC 5LP Advanced DMA Topics

   

http://www.cypress.com/documentation/application-notes/an61102-psoc-3-and-psoc-5lp-adc-data-bufferin...                AN61102 PSoC® 3 and PSoC 5LP - ADC Data Buffering Using DMA

   

http://video.cypress.com/video-library/search/dma/     Videos on DMA

   

https://www.youtube.com/results?search_query=dma+psoc Videos on DMA (some overlap)

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, G.

   

Your question why most of the examples are working with arrays is quite easily answered: The setup for "just" a single byte transfer is a large overhead, so a simple assignment would beat the DMA, even an interrupt driven solution would be faster.

   

It is always advisable to post a workspace bundle so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

0 Likes