SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By tiagofumo
#124932
hi... I'm going to use a camera module (ov7670) and I'll need to make a square wave generator with frequency about 12mhz...

I see that 555 is not able to make this thing because of the high frequency... so I would like to know what is the best option for this...

I see there is a programmable oscilator on sparkfun website from a few khz to 133 mhz oscilation but I can't order from sparkfun now as the shipping and time till
the board arrive will be like 30 days or more...

so I'm wondering if its possible to make a 12 mhz wave generator using a 12 mhz crystal or something like that...

can someone help me?

thx
User avatar
By elevator4
#124939
tiagofumo wrote:hi... I'm going to use a camera module (ov7670) and I'll need to make a square wave generator with frequency about 12mhz...
...depends on what you have in your parts box...
I'd start with this reading: http://www.fairchildsemi.com/an/AN/AN-340.pdf.
-you can use just about any cmos inverting gate
-use one more gate to buffer the output going into the camera module
-if you power the oscillator from 3.3 or 5 volts, you need to decouple the output with a cap
By tiagofumo
#124977
itikhonov wrote:If you have mcu you can drive camera from pin which drive crystal.
hm... how can I do this using a pic mcu?

I think I'll go with this idea as the components to make the oscilator on the app notes are a bit hard to get here... so I get in the same problem lol

but I have some pic mcus here... 16f877a, 18f4550 and 30f4011
User avatar
By itikhonov
#124987
tiagofumo wrote:
itikhonov wrote:If you have mcu you can drive camera from pin which drive crystal.
hm... how can I do this using a pic mcu?

I think I'll go with this idea as the components to make the oscilator on the app notes are a bit hard to get here... so I get in the same problem lol

but I have some pic mcus here... 16f877a, 18f4550 and 30f4011
Put crystal between OSC1 and OSC2 pins with capacitors like shown in datasheet. Connect OSC2 to XCLK pin on your camera. You should use HS oscillator mode to get full swing. Have no idea will it work in your case or not because signal will be more sinusoidal but may be camera can eat it as it will cross cmos thresholds.

People use such setup to drive multiple pics with one crystal. If this will break oscillation you can probably use something from 74HC logic as buffer.
By tiagofumo
#125016
elevator4 wrote:tiagofumo,
so you want a 12mhz oscillator, without having to buy any parts, and your parts box is empty.
That's a tough call :cry:
I have a lot of parts... but some parts I can't get on the electronics store on my city... like 300 pf electrolitic capacitor probably...

so I would need to ask for parts from another place... if I do this it's better to ask for the programmable clock generator at sparkfun...
edit: I don't want to order parts for sparkfun now because it will be like 30 days till it get here and like $9 shipping cost to brazil :S
(brasilian mondey ~= 1.7*dolar, so things can get a bit expensive when buying in dolars)

I have some MCUs here... the one I'll use with the camera is a stm32, which is using a 8mhz crystal so I can't use it as the clock output...
that's why I was looking for an alternative clock source... I can use a fpga to not only generate a 12mhz clock but also to do a lot of stuff (maybe to buffer the image for me to read when I need to) ... or use a square wave generator at my university, but I like things at home, and I don't have a FPGA here, I would need to borrow one or to use the ones at the university...

so I looked at the pdf with 3 inverter oscillator, which required just a few resistors, but there's a bit of math to find the parts values, and my math got a negative value, which means it's wrong (there's no negative resistance) so I just quited this idea lol

so yes, the best thing I can do is to use another mcu as a clock generator from the OSC2 pin :S

ps: if you want to make the math on that pdf to find out which resistors I use to get a 12mhz clock, that would be cool lols xD

ps2: I keed xD
User avatar
By elevator4
#125039
tiagofumo wrote:
elevator4 wrote:...but there's a bit of math to find the parts values, and my math got a negative value, which means it's wrong (there's no negative resistance) so I just quited this idea... lol
ou ligar para uma garota, abra uma garrafa de vinho, tocar uma música de samba e esperar...
By tiagofumo
#125099
n1ist wrote:The STM32 has a PLL; while the external crystal or internal oscillator is 8MHz, it gets multiplied up internally.
/mike
yeah I know... I run it on 78mhz... I see on a schematic that the guy putted it on pin for the TIMER1 I think, so maybe he's using a prescaler so he can reduce the clock to a value he wants to and feed the camera with it... I'm gonna try to search for this functionality

if anyone played with stm32 and knows about it, please tell me about it =)
By jesovn
#139677
I'm working with the OV7670 and a ST32F107. I've the same problem that you with the EXCLK. I've tried to generate the clock at 12.5MHz with timer3 but it doesn't work. It's very easy to generate this clock signal. If you need this code please ask to me. And if you have solved the problem please let me know!

Thank you!