Go Down

Topic: Atmega328p on breadboard issues (Read 1 time) previous topic - next topic

kshaund

I have an Duemilanove and have followed the tutorial for the minimal circuit http://arduino.cc/en/Tutorial/ArduinoToBreadboard including downloading of the breadboard.zip

I am in a Linux environment, using the Audrino IDE v22, blank 328p's
after uploading the ArduinoISP sketch, I proceeded to select the "ATmega328 on a breadboard (8 MHz internal clock)" and the burned the bootloader using "Adruno as ISP".

No errors were reported, so I burned the second one that I'd gotten.  The problem arose when I went to upload my sketch. 

avrdude reported an invalid signature for the 328p sig = 0x1e9406, after googling  for answers I found out this is the id for a 168.  I've tried alternate suggestions including downloading a hex file for the 328 bootloader(from several years ago) and re-burning, to no avail, the Id is now 0x000000. and looks like I need to try an HV programmer to recover the chips. 

My question is  how am I supposed to burn the bootloader for the 328p?  In the bootloader folder all the hex file names start with 'atmega168'. 



MarkT

Firstly the bootloader files are called 168 for both 168 and 328 as the bootloader is basically identical - only the flags and fuses and memory map differ.  Sounds like it burnt the wrong bootloader somehow.

I have the 0021 software and "ATmega328 on a breadboard (8 MHz internal clock)" isn't on the list of boards - this sounds like a custom entry in boards.txt?  It probably has the wrong bootloader file listed (you want ATmegaBOOT_168_atmega328.hex).  The 328 at the end of the filename is crucial.
[ I won't respond to messages, use the forum please ]

kshaund

The tutorial page http://arduino.cc/en/Tutorial/ArduinoToBreadboard has the download for the 8mhz internal clock on the 328.

I altered none of the settings in the file, I assumed the tutorial any included files would be proper.

MarkT

If you have a 16MHz crystal you don't want to fuse the chip for internal clock.
[ I won't respond to messages, use the forum please ]

kshaund

The project has no need for a clock greater than 8Mhz, which is why I chose to use the internal clock. I do not have a crystal, nor am interested in adding one, since it is a feature of the chip.

MarkT

I've found the boards.txt in the breadboard.zip - it specifies the bootloader

atmega328bb.bootloader.file=ATmegaBOOT_168_pro_8MHz.hex

I presume this is the only version for 8MHz internal clock - and its compiled for the 168...
[ I won't respond to messages, use the forum please ]

spycatcher2k

This is what i've been using :




atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

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

atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xD8
atmega328bb.bootloader.extended_fuses=0x07
atmega328bb.bootloader.path=atmega
atmega328bb.bootloader.file=ATmegaBOOT_168_ATMEGA328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino
Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

johnwasser


The problem arose when I went to upload my sketch. 

avrdude reported an invalid signature for the 328p sig = 0x1e9406, after googling  for answers I found out this is the id for a 168. 


Were you using ArduinoISP to try to load the sketch?  Does your Duemilanove have an ATmega168 in it?  If so, you forgot to disable auto-reset and you're talking to the Arduino bootloader on the Duemilanove rather than the ArduinoISP sketch.  They both speak variants of the STK500v1 protocol.

Disable auto-reset by connecting a small capacitor (1-10 microfarad) from the Reset pin of the Duemilanove to the Ground pin.  (The + side of the capacitor goes to Reset and the - side to Ground.)
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

kshaund

Quote
Were you using ArduinoISP to try to load the sketch?  Does your Duemilanove have an ATmega168 in it?  If so, you forgot to disable auto-reset and you're talking to the Arduino bootloader on the Duemilanove rather than the ArduinoISP sketch.  They both speak variants of the STK500v1 protocol.


No, not uploading  with AudrinoISP.  No, my Duemilanove has a 328p. I had disabled the auto reset. Also pulled the chip from the Duemilanove as the tutorial stated.

johnwasser

For some reason the bootloader thinks it was compiled for an ATmega168 and not an ATmega328P. 

Ick.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

kshaund

Thanks spycatcher2k.  Worked perfectly. I did notice this has to be added to the boards.txt in the hardware/arduino directory.  If added according to the tutorial, there will be compiling issues.


This is what i've been using :




atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)

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

atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xD8
atmega328bb.bootloader.extended_fuses=0x07
atmega328bb.bootloader.path=atmega
atmega328bb.bootloader.file=ATmegaBOOT_168_ATMEGA328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F

atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino

frank26080115

There is no way the 168 bootloader hex file would work for 328P, that's simply impossible, since the bootloader section starting address are completely different. Make sure you are burning a bootloader hex file that is compiled for 328P with the starting address set correctly
Freelance engineer, consultant, contractor. Graduated from UW in 2013.

thylux

Hi, I'm a newbie on electronics in general, and I've been trying for several days to use an ATMega328p on a breadboard with the minimal configuration as stated in the above referred tutorial.
I have a question related to this topic.

My 328s are all preloaded with the regular Arduino bootloader and I can upload sketches on all of them using the Arduino board.
I'm trying to burn the 'ATmegaBOOT_168_ATMEGA328_pro_8MHz.hex' using Arduino as ISP (with another 328p on Duemilanove), but AVRDude reports an Invalid Device Signature (even when disabling the auto-reset).

Is it possible that because the 328p are already loaded with the 16MHz bootloader, I will need to add a 16MHz crystal just to be able to burn the new bootloader?
I find it strange that, when using avrdude by command line, it reads all the fuses as 0x00 and the signature as 0x00 0x00 0x00 (hence Invalid Device Signature). That's what made me think that maybe I need the crystal for burning the bootloader...

If it helps, I've tried it with 0022 on Win7 32bit and 0021 on WinXP, and already tried several configurations that I read on this forum and several other sites.

frank26080115


Is it possible that because the 328p are already loaded with the 16MHz bootloader, I will need to add a 16MHz crystal just to be able to burn the new bootloader?


You will need the 16 MHz crystal, but it is because of the fuse bits are set for external crystal, not because of the hex file.
Freelance engineer, consultant, contractor. Graduated from UW in 2013.

thylux

Thanks! Bought the crystal today and burned the bootloader successfully. I could also upload a blink sketch and it is all working well...

Go Up