0
\$\begingroup\$

I have a sample code for connecting an OV7670 to a STM32F407IGT6.

However, I'm trying to use a STM32F407VGT6 and in my sample code the STM32F407IGT6 doesn't use the default DCMI pins.

How can I change this definition?

link of sample code: http://rodfile.com/rcu46djm5q41 this sample code is in the

stm32f4_dsp_stdperiph_lib  

from st official site, in directory

Project\STM32F4xx_StdPeriph_Examples\DCMI\DCMI_CameraExample

This sample code is for STM32F407IGH MCU

\$\endgroup\$
  • \$\begingroup\$ Please post code. \$\endgroup\$ – Funkyguy Feb 20 '16 at 18:06
  • \$\begingroup\$ link of sample code : rodfile.com/rcu46djm5q41 -------------------------------- this sample code is in the stm32f4_dsp_stdperiph_lib from st official site , in directory "Project\STM32F4xx_StdPeriph_Examples\DCMI\DCMI_CameraExample" ---------------------------------------- this sample code is for STM32F407IGH MCU . \$\endgroup\$ – xerxes Feb 20 '16 at 18:42
  • \$\begingroup\$ Possible duplicate of change STM32F407 DCMI interface pins for connect OV7670 digital camera \$\endgroup\$ – Roger Rowland Feb 20 '16 at 19:17
  • \$\begingroup\$ yes and i deleted The previous question. \$\endgroup\$ – xerxes Feb 20 '16 at 20:03
  • 1
    \$\begingroup\$ Yea, nobody is going to go download that. Its extra work from a sketchy site. If you want help, you have to post the exact code you are questioning \$\endgroup\$ – Funkyguy Feb 20 '16 at 21:30
1
\$\begingroup\$

You can select the alternate function of every pin using the GPIOx_AFRL and GPIOx_AFRH, with the help of the alternate function mapping in the datasheet you can see which pin is able to do which function (not all pins can be used as DCMI pin). Note that most of the functions are available on multiple pins and you should select only one pin for each alternate function.

For DCMI you have to use AF13.

As noted in the reference manual you must only select the alternate function for the data pins which are really used (D0-D7 for this camera).

But just selecting the alternate function is not enough. You also have to switch the pin to the alternate function using the GPIOx_MODER (writing 0b10 to the correct bits).


As DCMI has only inputs, the below is just additional information if you encounter alternate function outputs for something else:

Depending on the specification of the bus, you also have to set the output type to open-drain or push-pull using the GPIOx_OTYPER.

And finally the output speed must be selected, so that the pin can drive the outputs fast enough using the GPIOx_OSPEEDR.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.