2012-10-31 11:56 PM
hi:
I have interfaced camera with STM32F4 discovery. currently I am capturing the frame and after the first capture is complete, I disable Camera capture and start sending data from memory over USART2. it sequential. and works fine. now , I want to send data over USART2 at the same time as after each DMA memory location filled by camera DATA. Or i want to send the first frame data from DMA0 buffer while at the same time the next frame data will be filling to DMA1 buffer.(in double buffer mode) is it possible. and how>? any hint.... #dcmi-dma-camera #dma #usart #dcmi #wait-for-you--clive1-!-!-!2012-11-01 06:29 AM
There is no flow control between the DMA streams, so you can't set an out bound transfer against data you haven't yet received. Technically you can, but it's prone to data corruption, ie missing/losing.
Exchange regions of memory that the DMA Tx and Rx operations are using, or keep a list of regions/buffers which you pass off to each task as one completes.2012-11-01 10:30 PM
thanks.
if i have u array of 20 charecters name string[20]. and I want to transfer only 20 bytes of that array, 1-how can i do that? currently I have managed to transfer data of string[] through DMA over Usart TX , but it continues to transfer data from memory even after 20 bytes....and stops after transmitting large chunk of data! I am curious about 2-how DMA control this property? 3-how it knows when to stop transmitting DATA? 4-if it didn't know then why, after transmitting a large chunk of data form memory, it stops? Thanks.2012-11-02 02:05 AM
currently I have managed to transfer data of string[] through DMA over Usart TX , but it continues to transfer data from memory even after 20 bytes....and stops after transmitting large chunk of data! I am curious about
Providing the involved source code would be helpful. if i have u array of 20 charecters name string[20]. and I want to transfer only 20 bytes of that array,
1-how can i do that?
DMA_InitStructure.DMA_BufferSize = 20; DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;3-how it knows when to stop transmitting DATA?
When all data items, according to your configuration, are transmitted. The DMA may restart with the first item, if circular mode is configured. That would not make sense for feeding the UART, but is useful for the ADC.4-if it didn't know then why, after transmitting a large chunk of data form memory, it stops?
You probably configured something else then 20, and might even end up in some fault handler. But that is hard to judge without the source code...
2012-11-02 02:23 AM
Definitely sounds like you're using Circular mode, DMA by itself just needs a length/size setting, and it should stop.
Don't use Circular mode, and use the TC (Terminal Count) interrupt to set up the next transfer, or not, as appropriate.2012-11-02 02:47 AM
very thanks. I just thought that I should upload some part of my code.
while(1) { DMA_Configuration(); DMA_Cmd(DMA1_Stream6, ENABLE); while (DMA_GetFlagStatus(DMA1_Stream6, DMA_FLAG_TCIF2) == RESET); DMA_ClearFlag(DMA1_Stream6, DMA_FLAG_HTIF2 | DMA_FLAG_TCIF2); STM_EVAL_LEDOn(LED1); while(1); //USART_ClearFlag(USART2, USART_FLAG_TC); } ijust wanna tell after a large chunk of transmission , the transmission stops. and LED1 didnt get ON. means the CODE stuck in between some where..!!!
i will look upon the things u have mentioned2012-11-02 03:27 AM
2012-11-02 04:57 AM
while(DMA_GetFlagStatus(DMA1_Stream6, DMA_FLAG_TCIF2) == RESET);
DMA_ClearFlag(DMA1_Stream6, DMA_FLAG_HTIF2 | DMA_FLAG_TCIF2); Six not TWO DMA_InitStructure1.DMA_Mode = DMA_Mode_Circular; Circular is repetitive.2012-11-04 08:59 PM
thanks,clive. my bad.
but I have make this correction, i got same result. My led1 did'nt blink aslo? can't understand that behavior, is that mean controller is stuck in while(getstatus....)? I have also tried ur code u posted in ''DMA Memory To UART5''. but i got the same result. I got lot of data on my hyperterminal actually the same data as in my code. it always stops at the specif location (how i know that? because of same character appear every time) https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fDMA%20Memory%20To%20UART5&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tview...2012-11-04 09:58 PM