OV7670搭配STM32F4-discovery?

2019-07-16 02:34发布


我想用STM32F4-discovery这个板子来控制网路上买的OV7670
我是买没有FIFO,16PIN的OV7670 http://www.waveshare.net/Shop/OV7670-Camera-Board.htm
没有LCD,我想直接将资料传到电脑并用电脑解开

我参考了网路上的代码做修改
现在是设定OV7670为QCIF176* 144 RGB565
只是无论我怎么设定它出来的图片都是暗红 {MOD}的



上图是我做的测试,第一张是用黑纸罩住上半部,第二张是罩住右上半部,第三张罩住左上半部

花了快一个月研究可是一点头绪都没有
希望有人可以给我一点想法

这是我目前的程式 https://github.com/ctc8631/ov7670
我把ov7670的设定跟dcmi、dma的部份贴出来方便大家看 谢谢大家
        {0x11, 0xc0}, //1100 0000
        {0x12, 0x0c}, //0000 1100
        {0x70, 0x3a}, //0011 1010
        {0x71, 0x35}, //0011 0101
        {0x8c, 0x00}, //0000 0000
        {0x40, 0xd0}, //1101 0000
        {0x0c, 0x4c}, //0100 1100

        DCMI_InitStructure.DCMI_CaptureMode = DCMI_CaptureMode_SnapShot;
        DCMI_InitStructure.DCMI_SynchroMode = DCMI_SynchroMode_Hardware;
        DCMI_InitStructure.DCMI_PCKPolarity = DCMI_PCKPolarity_Rising;
        DCMI_InitStructure.DCMI_VSPolarity = DCMI_VSPolarity_High;               
        DCMI_InitStructure.DCMI_HSPolarity = DCMI_HSPolarity_Low;
        DCMI_InitStructure.DCMI_CaptureRate = DCMI_CaptureRate_All_Frame;
        DCMI_InitStructure.DCMI_ExtendedDataMode = DCMI_ExtendedDataMode_8b;

        DMA_DeInit(DMA_CameraToRAM_Stream);
        while (DMA_GetCmdStatus(DMA_CameraToRAM_Stream) != DISABLE)
        {
        }
        DMA_InitStructure.DMA_Channel = DMA_Camera_Channel;
        DMA_InitStructure.DMA_PeripheralBaseAddr = DCMI_DR_ADDRESS;
        DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)RAM_Buffer;
        DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
        DMA_InitStructure.DMA_BufferSize = picture_x*picture_y*2/4;
        DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
        DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
        DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
        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;



谢谢大家啰
image.png
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。