cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L053R: DMA incremental address mode

hardik
Associate II
Posted on July 31, 2017 at 15:48

Hi,

I am trying to configure TIM2 timer to trigger DMA every 400 uS and gather data from SPI buffer to local data buffer.

Buffer: uint16_t local_buffer[40];

Now every time timer interrupt occurs, i want DMA to store data from SPI buffer into local_buffer and increment address by 1 byte. This means, the next time interrupt occurs, it will copy data to next location of buffer.

I am able to trigger DMA and also copy data from SPI to local buffer. I have specified transaction size as 1 byte. I am observing that DMA is writing data to same location again and again i.e local_buffer[0].

I have set the MINC flag in DMA_CCR register. 

Kindly let me know if there is a way to write to next location of destination buffer on every trigger.

Thanks!

Hardik

#timer #dma-transfer #tim2 #dma #stm32l053
2 REPLIES 2
Posted on July 31, 2017 at 18:04

Evidently you're doing something wrong, a 16 byte/word buffer, should certainly be able to cycle in a loop, with a single transfer per TIM trigger. I've used these methods to copy pattern buffers to GPIO or DAC at a defined frequency.

You will likely want to dig into the reference manual and register settings to better understand the failure here.

SPI should be able to generate it's own DMA trigger, which actually matches the arrival of valid data rather than some event that is not related/tied to the arrival. I'm sure you have your reasons, work through the logic of the problem.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hardik
Associate II
Posted on August 03, 2017 at 07:43

Hi,

I am still not able to figure out how to achieve this. Can someone help with Timer/DMA configuration for this?