cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 port and OV7670 ?

antonius
Senior
Posted on April 08, 2014 at 04:11

Guys,

I have OV7670 module and STM32 dev board, I'm confused on how to connect the port of STM32 and OV7670 at the module because of the name of the port on OV7670 is different with in STM32 code, anyone has experience ? thanks


/*------------------------------------------------------

Ä£¿éÒý½ÅÃû³Æ | ÃèÊö | STM32¶ËÒý½Å�?¬½Ó |

------------------------------------------------------

SCCB_SCL : SCCBʱÖÓ : PB10 I2C2_SCL

SCCB_SDA : SCCBÊý¾�? : PB11 I2C2_SDA

CAM_VSYNC : Ö¡�?¬²½ : PA0 �?ⲿÖ�?¶�?0

CAM_HREF : FIFO : PB7 GPIO

CAM_WEN : FIFO�?´ÔÊ�?í : PD3 GPIO

XCLK : CMOS´«¸�?Æ÷Ö÷ʱÖÓ: PA8 MCOÊä³ö

CAM_RRST : FIFO¶�?µØÖ·¸´Î» : PE0 GPIO

CAM_REN : FIFOƬѡ : PD6 GPIO

CAM_RCLK : FIFO¶�?ʱÖÓ : PE1 GPIO

FIFO D0~D7 : FIFOÊý¾�?Êä³ö : PC0~PC7 GPIO

-----------------------------------------------------*/

0690X00000602sPQAQ.jpg
32 REPLIES 32
chen
Associate II
Posted on April 08, 2014 at 12:58

Hi

''Do I need 10K pull up resistor on SDA and SCL for I2C ?''

Yes

antonius
Senior
Posted on April 08, 2014 at 14:08

after I put 10K pull up, I got response, but I haven't seen a proper picture,

only dot dot red green blue cyan, but when I moved the sensor (ov7670) the LCD was moving as well....

Update,

 the display has displayed picture completely but very slow.....is it because of the 12MHz on OV7670 or I2C clock is too slow ?

Does anyone have experience ?thanks

antonius
Senior
Posted on April 08, 2014 at 15:25

Video :

http://youtu.be/GOrbSOZwWJc

Posted on April 08, 2014 at 15:43

the display has displayed picture completely but very slow.....is it because of the 12MHz on OV7670 or I2C clock is too slow ?

It I2C is use for configuration, I don't expect you'd need to keep talking to the camera via I2C once setup.

The DCMI speed would presumably dictate how fast the data was extracted from the FIFO

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
antonius
Senior
Posted on April 09, 2014 at 00:35

Can you tell me how to change DCMI speed ? what's DCMI ?

is it changing clock speed to 72 MHz, I saw :


/*-----------RCC_CLOCK_CONFIGURATION--------------------------*/

void
sar_RCC_Configuration(
void
)

{

RCC_DeInit();

RCC_ClearFlag();

/*enable HSE clock[RCC->CR-----WRITE BIT NO's 16 TO 1]*/

RCC_HSEConfig(RCC_HSE_ON);

if
((RCC->CR & RCC_HSE_ON))

{

/*Wait for HSERDY = 1 

(External high speed clock is ready to use)[BIT NO 17 in RCC->CR register]*/

while
((RCC->CR & RCC_FLAG_HSERDY)==0 ); 

/*used to flash code to hardware,system operating speed is 72MHz,

prefetch buffer is enabled to flash the Firm Ware and

so Flash Latency is selected to two wait states->if 48 MHz < SYSCLK „T 72 MHz */

FLASH->ACR = 0x12 ;

/*We used 8MHz external crystal and operating system frequency in 72MHz

by multiplying 8MHz 9 times to make it 72MHz[RCC->CFGR-----WRITE BIT NO's 21,20,19,18 TO 0,1,1,1]*/

RCC_PLLConfig(RCC_PLLSource_HSE_Div1,RCC_PLLMul_9);

/*PLL clock 1 is selected for APB1 bus because its operating speed is 36MHz hence 

High speed clock(72MHz) is divided by 2 to get 36MHz[RCC->CFGR-----WRITE BIT NO's 10,9,8 TO 1,0,0]*/

RCC_PCLK1Config(RCC_HCLK_Div2);

/*PLL clock 2 is selected for APB2 bus because its operating speed is 72MHz hence 

High speed clock(72MHz) is not divided[RCC->CFGR-----WRITE BIT NO's 13,12,11 TO 0,0,0]*/

RCC_PCLK2Config(RCC_HCLK_Div1);

/*ADC clock is selected for ADC bus because its maximum operating speed is 12MHz hence 

PLL clock(72MHz) is divided by 6 to get 12MHz[RCC->CFGR-----WRITE BIT NO's 15,14 TO 1,0]*/

RCC_ADCCLKConfig(RCC_PCLK2_Div6);

/*if above configuration is done then select SYSTEM clock ,maximum operating speed of system is 72MHz

,so select the PLL clock which gives 72MHz[RCC->CFGR-----WRITE BIT NO's 3,2 TO 1,0] */

RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

/*enable PLL clock[RCC->CR-----WRITE BIT NO's 24 TO 1]*/

RCC_PLLCmd(ENABLE);

while
(RCC_GetFlagStatus(RCC_FLAG_PLLRDY)==RESET);

while
(RCC_WaitForHSEStartUp()==ERROR);

} 

}

[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/SPI%20Master%20and%20Slave%20Configuration%20Problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentviews=96]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Discovery%2FSPI%20Master%20and%20Slave%20Configuration%20Problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=96
antonius
Senior
Posted on April 09, 2014 at 01:50

0690X00000602siQAA.jpg

Is it related with DRAM above ? thanks

Posted on April 09, 2014 at 02:07

Understand that most of the green text you post related to the pins reads as hieroglyphics

The FIFO is rated up to 50 MHz

The OV7670 from 10 to 48 MHz

What clock is you camera generating, or what clock are you passing to it? Are you generating a clock via the MCO pin PA8? Do you have a manual or data-sheet for your camera board/module?

 
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on April 09, 2014 at 02:14

DCMI is the Digital Camera Interface on the F4 parts, it's a very high speed parallel interface. As I recall up to 50 MHz

The F1 doesn't have one, so you are either using DMA or manual GPIO toggling/reading, the latter will be rather slow.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
antonius
Senior
Posted on April 09, 2014 at 02:24

Last progress :

0690X00000602seQAA.jpg

antonius
Senior