Go Down

Topic: Use of an external oscillator with atmega328P-PU (Read 1 time) previous topic - next topic

lugopaco

Hi everybody! Well, I'm making a school-proyect that envolves the atmega328P-PU (basically the duemilanove chip as the stand/alone mode with boot-loader). I tested it in a breadboard with a crystal of 16MHz and the capacitors of 22pF communicating with a bluesmirf (bluetooth antenna) at 57600bps to my pc with a bluetooth dongle and also with an android phone and works great!!!!!

Now I want to reduce the components to get the smaller I can the proyect. So... if I take out the crystal (obviosly also the capacitors) and use the internal oscillator: Would that make my whole proyect fail because the RS-232 communication needs some accuracy or which troubles i can get??? I have read some stuff but some people say that there would be no problem but others say that by using the RS-232 communication it has to be very accurately.

Grumpy_Mike

Yes it will mess up the serial communications from the ATmega chip to the USB bridge (there is no RS232 involved that is a voltage standard). This means you will not be able to upload any new code through the boot loader.
So you can either program it up before you make the changes or you can use an ATmega programmer to bypass the boot loader.

Alternatively you can use a ceramic resonator in place of a crystal because that will not need capacitors so there is some component reduction.

Jack Christensen

The datasheet says
Quote
9.6 Calibrated Internal RC Oscillator
By default, the Internal RC Oscillator provides an approximate 8.0MHz clock. Though voltage
and temperature dependent, this clock can be very accurately calibrated by the user.


I haven't tried it, but that statement makes me think it might be possible, assuming voltage and temperature are relatively steady, and the equipment and time to calibrate the internal oscillator are not issues.  Calibration is specific to each individual part, so if this is not a one-off, then that is also a consideration.  Seems I saw references to some software or firmware to aid in the calibration, so I might Google around for that.  So definitely some experimentation is in order.

But I have to ask, how much space is being saved?  Even though an HC49/US crystal is fairly small, separate load caps can be eliminated by using a resonator which is still good enough for serial communication.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

dc42

For RS232 you need a clock accuracy of around 2%, see http://www.maxim-ic.com/app-notes/index.mvp/id/2141. The internal oscillator has a frequency tolerance of +/- 10% at 25C. So you will need to use a crystal or ceramic resonator.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Grumpy_Mike

Quote
By default, the Internal RC Oscillator provides an approximate 8.0MHz clock.

But you need a clock of 16MHz to be compatible with the boot loader and I don't think you can get that from the internal clock.

lugopaco

#5
Aug 09, 2011, 10:08 pm Last Edit: Aug 09, 2011, 10:34 pm by lugopaco Reason: 1
Thanks a lot for your answers!! So I will keep the external oscillator to keep that troubles out. And now: do you recommend me to use the crystal, the resonator or is it practically the same???

dc42

There's not much difference between using a ceramic resonator or crystal, except that ceramic resonators are generally smaller and cheaper, and some types don't need capacitors. I used a 8MHz resonator type CSALF8M00T55-B0 purchased from Farnell in a recent Arduino project. It's quite small but it does need the capacitors.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

lugopaco


retrolefty

Here is an example and picture of a three terminal 16Mhz ceramic resonator. You ground the center pin and wire the outer pins to the AVR xtal pins. No caps required.

http://www.sparkfun.com/products/9420

kalum


Hi everybody! Well, I'm making a school-proyect that envolves the atmega328P-PU (basically the duemilanove chip as the stand/alone mode with boot-loader). I tested it in a breadboard with a crystal of 16MHz and the capacitors of 22pF communicating with a bluesmirf (bluetooth antenna) at 57600bps to my pc with a bluetooth dongle and also with an android phone and works great!!!!!

Now I want to reduce the components to get the smaller I can the proyect. So... if I take out the crystal (obviosly also the capacitors) and use the internal oscillator: Would that make my whole proyect fail because the RS-232 communication needs some accuracy or which troubles i can get??? I have read some stuff but some people say that there would be no problem but others say that by using the RS-232 communication it has to be very accurately.


Use either a ceramic resonator at 16mhz or just use the crystal with the 22pf caps. Trust me reducing the frequency to 8mhz and using the internal oscillator is not worth the trouble you encounter due to errors in the timing codes etc.
You can run the atmega328p at 16mhz reliably even at 3.3v, so dont worry too much about low clock speeds.

lugopaco

So the problem is solved: I will use the ceramic resonator to gain some free space at my board either to seek some problems with the internal oscillator. Many thanks!

Go Up