Pages: [1]   Go Down
Author Topic: AtMega328 basics  (Read 1473 times)
0 Members and 1 Guest are viewing this topic.
Vancouver
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm having trouble finding a few bits of information here:
I'm working on a project where I want to use the Duemilanove to program a 328 which will be then taken out of the Arduino and used on a pcb.
1: Does the chip have its own onboard oscillator?? or am I gonna need a 20MHz crystal on my PCB?
2: Diode cct protection: is this onboard on the chip, or am I going to need 50 diodes in my circuit?
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1: Does the chip have its own onboard oscillator?? or am I gonna need a 20MHz crystal on my PCB?

The chip has its own onboard oscillator, however:

1. Its maximum value is 8 MHz
2. The fuses have to be reconfigured to use it. By default the fuses are set to expect an external oscillator (16 MHz on an Arduino). You cannot change the fuses through regular program downloading...you have to use the ISP header.

Quote
2: Diode cct protection: is this onboard on the chip, or am I going to need 50 diodes in my circuit?

I assume you mean the ESD protection diodes? They are on the chip.

--
The Aussie Shield: breakout all 28 pins to quick-connect terminals
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 200
Posts: 12773
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
1: Does the chip have its own onboard oscillator?? or am I gonna need a 20MHz crystal on my PCB?

Yes.  The oscillator can run at 1 MHz or 8 MHz.  It is ±10% from the factory and can be tuned to ±1% (sometimes better).

Quote
2: Diode cct protection: is this onboard on the chip,


cct?  Counter Culture Terminology?  Cucumber Cutting Tube?

Quote
or am I going to need 50 diodes in my circuit?

What circuit?
Logged

Vancouver
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

wow, thanks! that was super quick!
awesome, diode cct (circuit) protection provided!!!
hmmm... so I think I will need a crystal, thank you very much
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just a warning...that "diode protection" is really meant only for ESD -- short-duration events. It is not going to protect the chip from long-lasting steady overvoltages. If you apply 7V (or higher) to any I/O pin and hold it there, the chip will fry.

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Kind of piggy backing on the end of this thread...

If I have an arduino w/ a 20MHz oscillator and I don't care about the delay(), micros(), millis(), etc.  Is this only thing necessary to change/create a board file to accommodate the change in clock speed from 16 to 20MHz?  I use the 6 pin ICSP programmer for everything so I don't have to deal with bootloaders.


thanks.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 200
Posts: 12773
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is this only thing necessary to change/create...

This?  What are you referring to?  Please provide more details.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is the boards.txt file in the arduino-00XX/hardware/arduino that contain something that looks like this:

Quote
atmega328.name=Arduino Duemilanove or Nano w/ ATmega328

atmega328.upload.protocol=stk500
atmega328.upload.maximum_size=30720
atmega328.upload.speed=57600

atmega328.bootloader.low_fuses=0xFF
atmega328.bootloader.high_fuses=0xDA
atmega328.bootloader.extended_fuses=0x05
atmega328.bootloader.path=atmega
atmega328.bootloader.file=ATmegaBOOT_168_atmega328.hex
atmega328.bootloader.unlock_bits=0x3F
atmega328.bootloader.lock_bits=0x0F

atmega328.build.mcu=atmega328p
atmega328.build.f_cpu=16000000L
atmega328.build.core=arduino

I am proposing just changing the 16000000L to 20000000L and using my ICSP programmer to skip the bootloader part.  I'm not sure if anything else has to be done.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 200
Posts: 12773
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You may have to change this...

Code:
atmega328.upload.protocol=stk500

...to match the protocol of your programmer.  Other than those two changes, you should be good to go.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok. great.  Thanks for the help.
Logged

Pages: [1]   Go Up
Jump to: