2017-07-31 06:48 AM
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 #stm32l0532017-07-31 09:04 AM
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.
2017-08-02 10:43 PM
Hi,
I am still not able to figure out how to achieve this. Can someone help with Timer/DMA configuration for this?