我就是想存在ram中,但是设置方式可能不对存到的数据一点点都收不到。用串口打印出来就是0xffff ffff 。这是初始化的数值。 DCMI_InitStructure.DCMI_CaptureMode = DCMI_CaptureMode_Continuous; //连续模式 DCMI_InitStructure.DCMI_SynchroMode = DCMI_SynchroMode_Hardware; //嵌入式
DCMI_InitStructure.DCMI_PCKPolarity = DCMI_PCKPolarity_Falling; //下降沿
DCMI_InitStructure.DCMI_VSPolarity = DCMI_VSPolarity_High; //垂直同步极性
DCMI_InitStructure.DCMI_HSPolarity = DCMI_HSPolarity_High; //水平同步极性
DCMI_InitStructure.DCMI_CaptureRate = DCMI_CaptureRate_All_Frame; //帧捕捉频率:所有,1/2或1/4 DCMI_CaptureRate_All_Frame
DCMI_InitStructure.DCMI_ExtendedDataMode = DCMI_ExtendedDataMode_8b;//指定数据宽度:8位,10位,12位或14位
DCMI_Init(&DCMI_InitStructure);
/* DCMI Interrupts config ***************************************************/
DCMI_ITConfig(DCMI_IT_VSYNC, ENABLE);
DCMI_ITConfig(DCMI_IT_LINE, ENABLE);
DCMI_ITConfig(DCMI_IT_FRAME, ENABLE);
DCMI_ITConfig(DCMI_IT_ERR, ENABLE);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = DCMI_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Configures the DMA2 to transfer Data from DCMI to the LCD ****************/
/* Enable DMA2 clock */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);
/* DMA2 Stream1 Configuration */
DMA_DeInit(DMA2_Stream1);
DMA_InitStructure.DMA_Channel = DMA_Channel_1; //dma流通道
DMA_InitStructure.DMA_PeripheralBaseAddr = DCMI_DR_ADDRESS; //外设地址
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)&pixel_data; //内存地址
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory; //外设到内存
DMA_InitStructure.DMA_BufferSize = 38400; //数据大小
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; //指定外设地址寄存器是否应增加或不
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; //指定内存地址寄存器是否应增加或不
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; //外设地址数据长度
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; //内存地址数据长度
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal; //运行模式 DMA_Mode_Normal DMA_Mode_Circular
DMA_InitStructure.DMA_Priority = DMA_Priority_High; //优先模式 Low Medium High VeryHigh
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable; //FIFO
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full; //FIFO的阈值水平
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single; //内存单通道
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; //外设单通道
DMA_Init(DMA2_Stream1, &DMA_InitStructure);
}
这是dma dcmi的初始化。帮我看看这个哪里有问题了。
void DCMI_IRQHandler(void)
{
if (DCMI_GetITStatus(DCMI_IT_VSYNC) != RESET) //帧同步输入
{
LCD_SetCursor(0,0);
LCD_REG = 0x0022;
if(count>0)
count--;
if(count == 0 )
{
count = 15;
flag = 1;
DCMI_Cmd(DISABLE);
DCMI_CaptureCmd(DISABLE);
printf("\r\n"); printf("\r\n"); printf("\r\n"); printf("\r\n"); printf("\r\n");
}
DCMI_ClearITPendingBit(DCMI_IT_VSYNC);
}
if (DCMI_GetITStatus(DCMI_IT_LINE) != RESET)
{
DCMI_ClearITPendingBit(DCMI_IT_LINE);
}
if (DCMI_GetITStatus(DCMI_IT_FRAME) != RESET) //帧同步输入
{
DCMI_ClearITPendingBit(DCMI_IT_FRAME);
}
if (DCMI_GetITStatus(DCMI_IT_ERR) != RESET)
{
DCMI_ClearITPendingBit(DCMI_IT_ERR);
}
}
这是中断函数。
|