Uploading an Arduino sketch to an ATMEGA168P-20PU

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mikevanis
 
Posts: 4
Joined: Mon Dec 06, 2010 3:54 pm

Uploading an Arduino sketch to an ATMEGA168P-20PU

Post by mikevanis »

Hi everyone,

I accidentally ordered 15 ATMEGA168P-20PUs and I don't have the heart to throw them away. I'm trying to see if there is a way of burning the Arduino Bootloader on these chips so that I can upload Arduino sketches on them.

I have a USBtinyISP and have tried to burn the normal 168 bootloader on them. I've also tried to upload a sketch without the bootloader, but that didn't work either. :(

I've read about modifying the boards.txt file so that the right registers are used when arduino tries to upload to the 168P, but I don't have that much experience with AVR programming and I can't really find anything of use in the chip's datasheet.

Any help would be very appreciated.
Cheers,
Mike

User avatar
westfw
 
Posts: 2008
Joined: Fri Apr 27, 2007 1:01 pm

Re: Uploading an Arduino sketch to an ATMEGA168P-20PU

Post by westfw »

It should be possible. The 168P is nearly identical to the regular 168; all you should really need to do is change the cputype in an existing 168 based boards.txt entry. I think the bootloader .hex file should work as-is...

newToArduino
 
Posts: 1
Joined: Mon Dec 06, 2010 4:57 pm

Re: Uploading an Arduino sketch to an ATMEGA168P-20PU

Post by newToArduino »

Try looking at this document on migrating to the 168P http://www.atmel.com/dyn/resources/prod ... oc8089.pdf

User avatar
mikevanis
 
Posts: 4
Joined: Mon Dec 06, 2010 3:54 pm

Re: Uploading an Arduino sketch to an ATMEGA168P-20PU

Post by mikevanis »

@westfw:

What do you think I should change the cputype to?

Cheers

User avatar
westfw
 
Posts: 2008
Joined: Fri Apr 27, 2007 1:01 pm

Re: Uploading an Arduino sketch to an ATMEGA168P-20PU

Post by westfw »

Well, "atmega168p" of course. But it doesn't seem to be supported in current versions of AVRDude, even in the 5.10 version I just downloaded from "the source." That's annoying...

Opinion seems to be that you can just copy the existing m168 definition and change the signature bytes in avrdude.conf;
I've attached what ought to work, though I'm not entirely comfortably recommending it without having tried it...

I wonder if gcc supports it? Hmm. If you use a "real" programmer to burn the existing 168 bootloader, say using the override flag, the bootloader will happily lie to the arduino IDE thereafter (saying that there is a plain 168 attached.)
Attachments
m168p.txt
Addition to avrdude.conf to support atmega168p
(6.02 KiB) Downloaded 360 times

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”