Go Down

Topic: Clock signal on a digital pin (Read 2616 times) previous topic - next topic

dattasaurabh82

Hello everyone.
I recently came up with a post where we can connect a hacked nintendo wii's pixart camera to Arduino via I2C. In the post they suggested that the camera's CLK, need to be 18, 20-25 MHz for 5 volt uControllers.
http://www.stephenhobley.com/blog/2009/03/01/pixartwiimote-sensor-library-for-arduino/comment-page-1/#comments
A guy named Adam McDonald commented in the same post that he's been able to use the clock signal of 8MHz from his Pro mini of 3.3v I/O lines  to the pixart camera.
Now I need a method be explained to me in an easy manner of "getting an 8Mhz signal by setting the fuse bytes on the Arduino to output the clock signal on a digital pin" (I don't understand how to get that 8MHz signal).
For that you obviously don't need to know that what I'm going to do with that signal. Just assume I need it?
Can anybody help me here with some real solutions.
Thanks in advance

fungus

#1
Feb 13, 2013, 05:30 pm Last Edit: Feb 13, 2013, 05:34 pm by fungus Reason: 1
You need to set bit 6 of "low_fuses".

The very easiest way to do this (IHMO) with the Arduino environment is to edit your boards.txt file (search for it in your arduino installation) and find the section for the board you're interested in.

It will look something like this:

Code: [Select]

pro328.name=Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328
pro328.upload.protocol=arduino
pro328.upload.maximum_size=30720
pro328.upload.speed=57600
pro328.bootloader.low_fuses=0xFF
pro328.bootloader.high_fuses=0xDA
pro328.bootloader.extended_fuses=0x05
pro328.bootloader.path=atmega
pro328.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
pro328.bootloader.unlock_bits=0x3F
pro328.bootloader.lock_bits=0x0F

pro328.build.mcu=atmega328p
pro328.build.f_cpu=8000000L
pro328.build.core=arduino
pro328.build.variant=standard


Make a copy of that section, change all the "pro328" to something like "pro328ck" and change "pro328ck.name" to something like "Arduino Pro Mini (3.3V, 8 MHz, CKOUT)" (That's what you see in the 'boards' menu).

Now you can edit the "pro328ck.low_fuses" entry to whatever value you want. If you select that entry in Tools->Board and do a "Burn bootloader" the fuses will be set. nb. You probably need to restart the Arduino IDE every time you edit that file.

The clock output bit is bit 6 of low_fuses, you need to set it to 0 without changing any other bits in low_fuses.

If you do it correctly the clock signal should appear on digital Pin 8.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

fungus

PS: This can't be done with a serial/FTDI cable. You'll need to set up some sort of ISP programmer.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Erni

Take a look at Nick Gammon's guide, for setting up a 8 Mhz timer on pin 9

http://www.gammon.com.au/forum/?id=11643

fungus


Take a look at Nick Gammon's guide, for setting up a 8 Mhz timer on pin 9

http://www.gammon.com.au/forum/?id=11643


On an 8mHz Pro Mini you can only get a 4mHz signal with a timer output.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Erni

Quote
On an 8mHz Pro Mini


Sorry I missed that, was thinking  16mHz

CrossRoads

You should be able to get 8 MHz on an 8MHz Promini:

9.9 Clock Output Buffer
The device can output the system clock on the CLKO pin. To enable the output, the CKOUT Fuse has to be programmed.
This mode is suitable when the chip clock is used to drive other circuits on the system. The clock also
will be output during reset, and the normal operation of I/O pin will be overridden when the fuse is programmed.
Any clock source, including the internal RC Oscillator, can be selected when the clock is output on CLKO. If the
System Clock Prescaler is used, it is the divided system clock that is output.

This is not using a Timer output, its the free-running 8 MHz clock.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

dattasaurabh82

Thanks will try it out soon tomorrow

fungus


You should be able to get 8 MHz on an 8MHz Promini:

9.9 Clock Output Buffer
The device can output the system clock on the CLKO pin. To enable the output, the CKOUT Fuse has to be programmed.


Yep, that's what my post was all about - setting bit 6 of low_fuse.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

dattasaurabh82

It would also better if anybody can show me how to bootload an Arduino Pro mini 3.3 volt. Any tutorial link for promini 3.3V will do.

dattasaurabh82

I came up with this here
http://arduino.cc/en/Tutorial/ArduinoISP

My questions:
1. Do I need to put a logic level converters between the wires as I'm going to bootload the Arduino Pro Mini 3.3v with my Arduino Uno(5V)?
2. Do I need to put a 10uf cap between Reset & GND & should the RESET line of the programmer ARDUINO UNO go to PIN 10 of my Pro mini & ground parallel?

fungus

#11
Feb 14, 2013, 10:19 am Last Edit: Feb 14, 2013, 10:21 am by fungus Reason: 1

I came up with this here
http://arduino.cc/en/Tutorial/ArduinoISP

My questions:
1. Do I need to put a logic level converters between the wires as I'm going to bootload the Arduino Pro Mini 3.3v with my Arduino Uno(5V)?


The pins have protection diodes but the datasheet says the maximum voltage on an i/O pin is Vcc+0.5V so it's best to use them. it. A simple resistor divider will do for 5V->3.3V, for 3.3V->5V (ie. MISO) you don't need anything.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

dattasaurabh82

It worked. I did used a tutorial on how to bootload a Arduino using other arduino. Used it to bootload my Arduino Pro mini 3.3v with modified clock ouput pin 8 & used the successful Pvision lib for the exp. Yanks a lot

Go Up