大学生
最后登录1970-1-1
在线时间 小时
注册时间2017-9-18
|
使用F767驱动OV2640采集图像到LCD上,首先对OV2640接的DCMI的GPIO接口初始化,再对I2C的的GPIO口初始化,再写入I2C配置,读OV2640厂家PIDH发送到串口总是0,不是正常的0X26,为什么没有识别到OV2640是什么原因啊??下面是对I2C的配置。。求求大神解答~卡在这里好久了~~~
void I2C_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
__HAL_RCC_I2C4_CLK_ENABLE();
__GPIOD_CLK_ENABLE();
GPIO_InitStructure.Pin = GPIO_PIN_12;
GPIO_InitStructure.Mode = GPIO_MODE_AF_OD;
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
GPIO_InitStructure.Pull= GPIO_NOPULL;
GPIO_InitStructure.Alternate=GPIO_AF4_I2C4;
HAL_GPIO_Init(GPIOD, &GPIO_InitStructure);
GPIO_InitStructure.Pin = GPIO_PIN_13;
GPIO_InitStructure.Alternate=GPIO_AF4_I2C4;
HAL_GPIO_Init(GPIOD, &GPIO_InitStructure);
if(HAL_I2C_GetState(&I2C_Handle) == HAL_I2C_STATE_RESET)
{
SENSORS_I2C_FORCE_RESET();
SENSORS_I2C_RELEASE_RESET();
I2C_Handle.Instance = I2C4;
I2C_Handle.Init.Timing = 0x60201E2B;//100KHz
I2C_Handle.Init.OwnAddress1 = 0;
I2C_Handle.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
I2C_Handle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
I2C_Handle.Init.OwnAddress2 = 0;
I2C_Handle.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
I2C_Handle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
I2C_Handle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
HAL_I2C_Init(&I2C_Handle);
HAL_I2CEx_AnalogFilter_Config(&I2C_Handle, I2C_ANALOGFILTER_ENABLE);
}
}
|
|