2015-03-21 02:11 PM
Hello!
First of all there is worth to mention that I have successful communication with OV7670 camera on STM32F407VG Discovery and I getting QCIF format picture in YCbCr format and sending it via USB to computer as virtual port to display image in Matlab function then. For now I can hold 2x QCIF images in YCrCr format which occupies little more than 100kB of memory. My problem is that, I want get only grey format data so that I would store 4x QCIF images using the same memory space, but using only DMA configuration without CPU intervention. According to camera datasheet there is no configuration to get grey scale directly. So I've got grey scale by taking only Luma 'Y' component (which in fact is grey color) and then skipping Chroma 'Cb' and 'Cr' in Matlab which are interleaved in DCMI FIFO as below:DMA_InitStructure.DMA_Channel = DMA_CHANNEL_1;
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(&DCMI->DR);
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)frame_buffer;
DMA_InitStructure.DMA_DIR = DMA_PERIPH_TO_MEMORY;
DMA_InitStructure.DMA_BufferSize = (ROW*COLUMNS*BYTESPERPIX)/4;
DMA_InitStructure.DMA_MemoryInc = DMA_MINC_ENABLE;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PDATAALIGN_WORD;
DMA_InitStructure.DMA_MemoryDataSize =DMA_MDATAALIGN_BYTE;
//<- Even so, there is WORD allign
DMA_InitStructure.DMA_Mode = DMA_NORMAL;
DMA_InitStructure.DMA_Priority = DMA_PRIORITY_VERY_HIGH;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMODE_ENABLE;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
DMA_InitStructure.DMA_MemoryBurst = DMA_MBURST_SINGLE;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PBURST_SINGLE;
I struggle with finding the way to have direct transfer of Luma component byte after byte to memory. Now it looks like in this way: