2015-11-24 06:39 PM
I am currently using STM32F4 Discovery board, and i configure UART 2 into DMA mode for sending data.
i am able to send data with a fixed length to UART 2 using DMA. But, i want to send data with a variable length. Example 1:Buffer = ''hello world!''
2: Buffer = ''is this working again?'' 3: Buffer = ''i want to use dma tx mode'' I could do that by reconfiguring the DMA_Init, each before I send the data as shown belowDMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)Buffer;
DMA_InitStructure.DMA_BufferSize = (uint16_t)strlen(Buffer); DMA_Init(DMA1_Stream5, &DMA_InitStructure); Is this the right way to do it? But, i read from the document, whenever I init the DMA, it will take sometime and there is a possibility that I could corrupt the previous DMA transfer. May i know how to a proper way?2015-11-25 05:41 AM
[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/Failing%20to%20set%20up%20USART%20DMA%20TX&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21¤tviews=57]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Java%2FFailing%20to%20set%20up%20USART%20DMA%20TX&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21¤tviews=57
The method for the F4 would be very similar, the code is probably overly verbose for clarity, but should give you are starting point. I may have built an F4 version of this, but this is the one that dropped out of a quick search.