2012-07-11 04:55 AM
Hello ,
I am new to STM32. I am reading data from USART using DMA. I dont know how to directly access data from DMA memory after transfer complete interrupt.2012-07-11 05:53 AM
Just like any other memory. Use pointers or array access.
If you passed &Buffer to the DMA controller as the transfer address, then Buffer[i]2012-07-11 09:29 PM
2012-07-12 02:47 AM
uint8_t *BufferStart = (uint8_t *)0x20004000; // An Address in RAM
uint32_t BufferSize = 10240; .. DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)BufferStart; DMA_InitStructure.DMA_BufferSize = (uint16_t)BufferSize; .. for(i=0; i<BufferSize; i++) sum += BufferStart[i]; Although I can't see why you couldn't statically allocate the buffer.2012-07-12 03:54 AM
Thanks for your reply,
Actually i am confused in a little bit different manner. For example if I give this Address (e.g 0x20004000) to DMA to start writing from here, and if in my code there are many local functions that create random variables , so is it possible that DMA may corrupt these variables (because DMA only knows the starting address and buffer size ). Pls clarify me in this regard.2012-07-12 06:18 AM
Which is why most of us would statically allocate such buffers, or carve out some space by modifying the linker script or scatter file.