Arduino (328P) on different clock / crystal

Hi

I am having trouble getting an 328P (pulled from a working Arduino Uno) to run on a breadboard. When I set it up with a external 8Mhz crystal (arduino tutorial) I can upload new sketches. I don't have a 16Mhz crystal, so couldn't test this.

However when using another crystal (e.q. 20Mhz or 14.31818Mhz) it just won't run. I tried to add an hardware profile based on the uno, only changing the fcpu setting, but also no success. As I understand, I don't have to burn fuses, since the ATM328 worked on the uno which also uses an external crystal and the fuse-settings for 8Mhz and above are the same.

What am I missing?

Do I need a specific bootloader for the 14.31818 crystal and if so, can I build this using the Arduino IDE, or do I need to use another development program?

NardJ:
Hi

I am having trouble getting an 328P (pulled from a working Arduino Uno) to run on a breadboard. When I set it up with a external 8Mhz crystal (arduino tutorial) I can upload new sketches. I don't have a 16Mhz crystal, so couldn't test this.

However when using another crystal (e.q. 20Mhz or 14.31818Mhz) it just won't run. I tried to add an hardware profile based on the uno, only changing the fcpu setting, but also no success. As I understand, I don't have to burn fuses, since the ATM328 worked on the uno which also uses an external crystal and the fuse-settings for 8Mhz and above are the same.

What am I missing?

What is your actual clock circuit, The breadboard habit of just connecting a crystal and hoping stray capacitance is enough for the oscillator to start is a bad habit.

Chuck.

You won't be able to upload sketches via serial, because the chip divides the CPU clock to get the UART clock. Other than that, I suspect the chip is running just fine.

For 16 vs 8, you can use the same bootloader, just at double the baud rate for 16mhz.

For other frequencies, unless they happen to work out right for an available baud rate, require you to recompile the bootloader for the appropriate frequency.

Thx for your replies. I also did some research and as I understand it now:

    • The bootloader is only needed when uploading a sketch to the 328P chip using serial / usb (e.g. UNO) board. This bootloader has the job to receive the sketch from the pc and write it to the chip. These bootloaders expect a certain crystal/resonator frequency in communicating with your pc and when changing this frequency, you need to use another bootloader for uploading to remain possible.
    • When using an isp (in my case an usbasp) programmer, the bootloader is not used (and in fact overwritten by my sketch) and the frequency does not matter.
    • However if this frequency becomes lower than 8Mhz or you want to use the internal resonator/crystal of the 328 you need the burn some fuses.

Using your info and this knowledge I switched to my usbasp programmer, but it still only worked when using the 8Mhz crystal. Don't know why, but I decided to use other 22pF capacitors (originally I had 2x 22pF 1KV from crystal pins to ground). Now suddenly it works with my other 14.31818, 16 and 20 Mhz crystals! So possibly the cause of my problems were these 'incompatible' capacitors all along.

(Of course without changing boards.txt in the hardware folder of the Arduino IDE, the 328P/timing functions think I'm still using a 16Mhz crystal and e.g. the delay function runs faster when using a 20Mhz crystal)