Accessing data stored in DMA memory by USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-07-11 4: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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-07-11 5: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]Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-07-11 9:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-07-12 2: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.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-07-12 3: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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-07-12 6: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.
Up vote any posts that you find helpful, it shows what's working..
