AnsweredAssumed Answered

STM32F4 connect to camera OV7670 and send image to PC

Question asked by wayne.bruce.002 on Jan 7, 2016
Hello,
I use STM32F4 discovery board connect to cmos digital camera OV7670, I know STM32F4 have DCMI which have capture image from camera and i have sent success image from camera to TFT 2.8 inch(DCMI -> FSMC thought DMA) but now i want to send image from dcmi to my computer thought UART(use module PL2303), however, i receive nothing. I was try to find all of project, document, tutorial which relate to my project, but seem nobody do it, they just use camera capture image and send it to TFT by FSMC. So now what should i do to send iamge from dcmi to uart.  
Note: because stm32f4 don't have DMA peripheral to peripheral , i sent image from DCMI to buffer[240x320x2] thought DMA(from peripheral to memory), then i send image from buffer[240x320x2] to UAR4 thought DMA(from memory to peripheral)

uint16_t Buffer[240x320x2];

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);  
     DMA_DeInit(DMA2_Stream1);
  DMA_StructInit(&DMA_InitStructure);
  DMA_InitStructure.DMA_Channel = DMA_Channel_1;
  DMA_InitStructure.DMA_PeripheralBaseAddr =  (uint16_t)&DCMI->DR;
  DMA_InitStructure.DMA_Memory0BaseAddr =  (uint16_t)&frame_buffer;
  DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
  DMA_InitStructure.DMA_BufferSize = 0xffff;
  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
  DMA_InitStructure.DMA_Priority = DMA_Priority_High;
  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;
  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
  DMA_Init(DMA2_Stream1, &DMA_InitStructure);




RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE);
  DMA_DeInit(DMA1_Stream4);
 
  DMA_InitStructure.DMA_Channel = DMA_Channel_4;
  DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; 
  DMA_InitStructure.DMA_Memory0BaseAddr = (uint16_t)&frame_buffer;
  DMA_InitStructure.DMA_PeripheralBaseAddr = (uint16_t)&UART4->DR;
  DMA_InitStructure.DMA_BufferSize = 0xffff;
  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
  DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
  DMA_InitStructure.DMA_Priority = DMA_Priority_High;
  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;
  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;

Outcomes