2014-07-20 11:23 AM
Hullo guys , I 'm writing my own Library for OV7670 Cam , using DCMI , I could talk to the cam properly through I2C , n now the probelm is that im trying to generate the LINE (HSYNC) interrupt as part of the testing , ( without using the DAM yet) , n the interrupt is never generated , I tried to put the HSYNC pin of the cam on scope , and it is working as it should .
Here is my IO , DCMI and NVIC Configurations // // //D0->PA9 //D1->PA10 //D2->PC8 //D3->PC9 //D4->PC11 //D5->PB6 //D6->PB8 //D7->PB9 //HSYNC->PA4 //VSYNC->PB7 //PIXEL_CLK->PA6 //XCLK->PA8(MCO1) DCMI_InitTypeDef DCMI_Struct; NVIC_InitTypeDef NVIC_DCMI ; GPIO_InitTypeDef GPIO; // Enable IO clock RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC, ENABLE); //IO initialize // GPIOA (4,6,9,10) GPIO.GPIO_Mode=GPIO_Mode_AF; GPIO.GPIO_OType=GPIO_OType_PP; GPIO.GPIO_Speed=GPIO_Speed_100MHz; GPIO.GPIO_PuPd=GPIO_PuPd_NOPULL; GPIO.GPIO_Pin=GPIO_Pin_4 | GPIO_Pin_6 | GPIO_Pin_9 | GPIO_Pin_10; GPIO_PinAFConfig(GPIOD, GPIO_PinSource4, GPIO_AF_DCMI); GPIO_PinAFConfig(GPIOD, GPIO_PinSource6, GPIO_AF_DCMI); GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_DCMI); GPIO_PinAFConfig(GPIOD, GPIO_PinSource10, GPIO_AF_DCMI); GPIO_Init(GPIOA, &GPIO); // // GPIOB (6,7,8,9) GPIO.GPIO_Pin=GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 ; GPIO_PinAFConfig(GPIOD, GPIO_PinSource6, GPIO_AF_DCMI); GPIO_PinAFConfig(GPIOD, GPIO_PinSource7, GPIO_AF_DCMI); GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_DCMI); GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_DCMI); GPIO_Init(GPIOB, &GPIO); // // // GPIOC (8,9,11) GPIO.GPIO_Pin=GPIO_Pin_8 | GPIO_Pin_9 |GPIO_Pin_11; GPIO_PinAFConfig(GPIOD, GPIO_PinSource6, GPIO_AF_DCMI); GPIO_PinAFConfig(GPIOD, GPIO_PinSource7, GPIO_AF_DCMI); GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_DCMI); GPIO_Init(GPIOC, &GPIO); // // Configure the DCMI // Enable the Clck of the DCMI module RCC_AHB2PeriphClockCmd (RCC_AHB2Periph_DCMI , ENABLE); // Reset the DCMI Registers RCC_AHB2PeriphResetCmd(RCC_AHB2Periph_DCMI, ENABLE); RCC_AHB2PeriphResetCmd(RCC_AHB2Periph_DCMI, DISABLE); // // Configure the DCMI DCMI_Struct.DCMI_CaptureMode=DCMI_CaptureMode_SnapShot; DCMI_Struct.DCMI_CaptureRate=DCMI_CaptureRate_All_Frame; DCMI_Struct.DCMI_ExtendedDataMode=DCMI_ExtendedDataMode_8b; DCMI_Struct.DCMI_HSPolarity=DCMI_HSPolarity_Low; DCMI_Struct.DCMI_PCKPolarity=DCMI_PCKPolarity_Rising; DCMI_Struct.DCMI_VSPolarity=DCMI_VSPolarity_High ; DCMI_Struct.DCMI_SynchroMode=DCMI_SynchroMode_Hardware; DCMI_Init(&DCMI_Struct); // // Enable the NVIC for the DCMI NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); NVIC_DCMI.NVIC_IRQChannel=DCMI_IRQn; NVIC_DCMI.NVIC_IRQChannelCmd=ENABLE; NVIC_DCMI.NVIC_IRQChannelPreemptionPriority=1; NVIC_DCMI.NVIC_IRQChannelSubPriority=1; NVIC_Init(&NVIC_DCMI); // // Enable the DCMI Interrupts DCMI_ITConfig(DCMI_IT_LINE , ENABLE); // LINE // // Enable the Capture mode DCMI_CaptureCmd(ENABLE); DCMI_Cmd(ENABLE); // // I never get into the Interrupt handler of the DCMI ....... Any ideas ?2014-07-20 06:13 PM
So NOT GPIOD for all the other pins in GPIO_PinAFConfig() !!!
// GPIOA (4,6,9,10)
GPIO.GPIO_Mode=GPIO_Mode_AF;
GPIO.GPIO_OType=GPIO_OType_PP;
GPIO.GPIO_Speed=GPIO_Speed_100MHz;
GPIO.GPIO_PuPd=GPIO_PuPd_NOPULL;
GPIO.GPIO_Pin=GPIO_Pin_4 | GPIO_Pin_6 | GPIO_Pin_9 | GPIO_Pin_10;
GPIO_PinAFConfig(GPIOD, GPIO_PinSource4, GPIO_AF_DCMI);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource6, GPIO_AF_DCMI);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_DCMI);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource10, GPIO_AF_DCMI);
GPIO_Init(GPIOA, &GPIO);
//
// GPIOB (6,7,8,9)
GPIO.GPIO_Pin=GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 ;
GPIO_PinAFConfig(GPIOD, GPIO_PinSource6, GPIO_AF_DCMI);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource7, GPIO_AF_DCMI);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_DCMI);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource9, GPIO_AF_DCMI);
GPIO_Init(GPIOB, &GPIO);
//
//
// GPIOC (8,9,11)
GPIO.GPIO_Pin=GPIO_Pin_8 | GPIO_Pin_9 |GPIO_Pin_11;
GPIO_PinAFConfig(GPIOD, GPIO_PinSource6, GPIO_AF_DCMI);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource7, GPIO_AF_DCMI);
GPIO_PinAFConfig(GPIOD, GPIO_PinSource8, GPIO_AF_DCMI);
GPIO_Init(GPIOC, &GPIO);
//
2014-07-20 07:11 PM
OMG , thx a lot clive , i was copying the Pin config from another file (saving few seconds lol) , n it turned out to wast few hours not to notice that . Its working ok now .
THX again man .