cancel
Showing results for 
Search instead for 
Did you mean: 

How to end a DMA circular mode transfer?

henrik239955_stm1
Associate II
Posted on April 15, 2013 at 12:05

Hello

I have setup a timer comparator to toggle an output pin. The comparator values are loaded with a DMA set up to work in circular mode and the output toggles as expected until the last round of data to be output. The last time I fill one half of the circular buffer I'm not likely to have the right number of data to fill it all and I can not just fill it with dummy data as this would cause undesirable toggling of the output pin. I can not change the number of data to transfer while the DMA channel is enabled. Does any one know how to deal with this.

#dma-circular-mode-timer-toggle
2 REPLIES 2
Posted on April 15, 2013 at 12:23

Stop it after the last complete buffer, and then start a ''normal mode'' DMA transfer with the rest of data.

JW

henrik239955_stm1
Associate II
Posted on April 15, 2013 at 13:03

I've added the circular buffer to be sure the comarator is always updated with new data on time. I think one problem could be to setup the DMA to normal mode in time. (Output wave form is in µs domain)? 

I've decided to go for adding dummy data (with maximum duration) and poll the DMA counter to findout when completed. Not the nicest, but it will do.

Thanks.