wrong mcu value for own board.txt entry ?

I have a breadboard without crystal and want to run an atmega328 mcu on it.
I took the uno entry and modified it :

solo.name=Standalone 328
solo.upload.protocol=usbtiny
solo.upload.maximum_size=32256
solo.upload.speed=115200
solo.bootloader.low_fuses=0xe2
solo.bootloader.high_fuses=0xd0
solo.bootloader.extended_fuses=0x07
solo.bootloader.path=optiboot
solo.bootloader.file=optiboot_atmega328.hex
solo.bootloader.unlock_bits=0x3F
solo.bootloader.lock_bits=0x0F
solo.build.mcu=ATMEGA328
solo.build.f_cpu=8000000L
solo.build.core=arduino
solo.build.variant=standard

The atmega328 is very similar to the atmega328p except the [b]Device signature = 0x1e9514 [/b]
Thus I copied the id ="m328p" entry in avrdude.conf to add a m328 entry:

#------------------------------------------------------------
# ATmega328
#------------------------------------------------------------
part
    id			= "m328";
    desc		= "ATMEGA328";
    has_debugwire	= yes;
    flash_instr		= 0xB6, 0x01, 0x11;
    eeprom_instr	= 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
			  0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
			  0x99, 0xF9, 0xBB, 0xAF;
    stk500_devcode	= 0x86;
    # avr910_devcode	= 0x;
    signature		=[b] 0x1e 0x95 0x14[/b];

Problem: When running upload using programmer, I get

unknown MCU 'ATMEGA328' specified
Known MCU names:
   avr2

...
When using the original solo.build.mcu=atmega328p
avrdude is called like this:

C:\Program Files (x86)\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v [b]-patmega328p [/b]-cusbtiny -Pusb -Uflash:w:C:\Users\MICHA~1.MIC\AppData\Local\Temp\build6454494266416353871.tmp\MyBlink.cpp.hex:i

and later it reports

avrdude: Device signature = 0x1e9514
avrdude: Expected signature for ATMEGA328P is 1E 95 0F

resulting in "Wrong microcontroller found ..."

Where's the relation between the .mcu line in boards.txt and the -p parameter for avrdude, which should be either m328p or m328 , shouldn't it ?

I think this line:

solo.build.mcu=ATMEGA328

should be:

solo.build.mcu=atmega328

Thanks Tom, but no:

unknown MCU 'atmega328' specified

Next guess anyone ? :wink:

Where is this list of known mcu's
avr2 ... attiny28
?

Ahh, the signature is 0x1e 0x95 0x14 for the atmega328.

According to this site, you have to do the following:

In the boards.txt file, say that you are using an atmega328p, but in the avrdude.conf file, add the following:

#————————————————————
 # ATmega328 (non-picopower)
 #————————————————————
 
part
 id = “m328?;
 desc = “ATMEGA328?;
 has_debugwire = yes;
 flash_instr = 0xB6, 0×01, 0×11;
 eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0×00,
 0xBE, 0×01, 0xB6, 0×01, 0xBC, 0×00, 0xBB, 0xBF,
 0×99, 0xF9, 0xBB, 0xAF;
 stk500_devcode = 0×86;
 # avr910_devcode = 0x;
 signature = 0x1e 0×95 0×14;
 pagel = 0xd7;
 bs2 = 0xc2;
 chip_erase_delay = 9000;
 pgm_enable = “1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1?,
“x x x x x x x x x x x x x x x x”;
 
chip_erase = “1 0 1 0 1 1 0 0 1 0 0 x x x x x”,
“x x x x x x x x x x x x x x x x”;
 
timeout = 200;
 stabdelay = 100;
 cmdexedelay = 25;
 synchloops = 32;
 bytedelay = 0;
 pollindex = 3;
 pollvalue = 0×53;
 predelay = 1;
 postdelay = 1;
 pollmethod = 1;
 
pp_controlstack =
 0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
 0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
 0×66, 0×76, 0×67, 0×77, 0x6A, 0x7A, 0x6B, 0x7B,
 0xBE, 0xFD, 0×00, 0×01, 0×00, 0×00, 0×00, 0×00;
 hventerstabdelay = 100;
 progmodedelay = 0;
 latchcycles = 5;
 togglevtg = 1;
 poweroffdelay = 15;
 resetdelayms = 1;
 resetdelayus = 0;
 hvleavestabdelay = 15;
 resetdelay = 15;
 chiperasepulsewidth = 0;
 chiperasepolltimeout = 10;
 programfusepulsewidth = 0;
 programfusepolltimeout = 5;
 programlockpulsewidth = 0;
 programlockpolltimeout = 5;
 
memory “eeprom”
paged = no;
 page_size = 4;
 size = 1024;
 min_write_delay = 3600;
 max_write_delay = 3600;
 readback_p1 = 0xff;
 readback_p2 = 0xff;
 read = ” 1 0 1 0 0 0 0 0?,
” 0 0 0 x x x a9 a8?,
” a7 a6 a5 a4 a3 a2 a1 a0?,
” o o o o o o o o”;
 
write = ” 1 1 0 0 0 0 0 0?,
” 0 0 0 x x x a9 a8?,
” a7 a6 a5 a4 a3 a2 a1 a0?,
” i i i i i i i i”;
 
loadpage_lo = ” 1 1 0 0 0 0 0 1?,
” 0 0 0 0 0 0 0 0?,
” 0 0 0 0 0 0 a1 a0?,
” i i i i i i i i”;
 
writepage = ” 1 1 0 0 0 0 1 0?,
” 0 0 x x x x a9 a8?,
” a7 a6 a5 a4 a3 a2 0 0?,
” x x x x x x x x”;
 
mode = 0×41;
 delay = 20;
 blocksize = 4;
 readsize = 256;
 ;
 
memory “flash”
paged = yes;
 size = 32768;
 page_size = 128;
 num_pages = 256;
 min_write_delay = 4500;
 max_write_delay = 4500;
 readback_p1 = 0xff;
 readback_p2 = 0xff;
 read_lo = ” 0 0 1 0 0 0 0 0?,
” 0 0 a13 a12 a11 a10 a9 a8?,
” a7 a6 a5 a4 a3 a2 a1 a0?,
” o o o o o o o o”;
 
read_hi = ” 0 0 1 0 1 0 0 0?,
” 0 0 a13 a12 a11 a10 a9 a8?,
” a7 a6 a5 a4 a3 a2 a1 a0?,
” o o o o o o o o”;
 
loadpage_lo = ” 0 1 0 0 0 0 0 0?,
” 0 0 0 x x x x x”,
” x x a5 a4 a3 a2 a1 a0?,
” i i i i i i i i”;
 
loadpage_hi = ” 0 1 0 0 1 0 0 0?,
” 0 0 0 x x x x x”,
” x x a5 a4 a3 a2 a1 a0?,
” i i i i i i i i”;
 
writepage = ” 0 1 0 0 1 1 0 0?,
” 0 0 a13 a12 a11 a10 a9 a8?,
” a7 a6 x x x x x x”,
” x x x x x x x x”;
 
mode = 0×41;
 delay = 6;
 blocksize = 128;
 readsize = 256;
 
;
 
memory “lfuse”
size = 1;
 min_write_delay = 4500;
 max_write_delay = 4500;
 read = “0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0?,
“x x x x x x x x o o o o o o o o”;
 
write = “1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0?,
“x x x x x x x x i i i i i i i i”;
 ;
 
memory “hfuse”
size = 1;
 min_write_delay = 4500;
 max_write_delay = 4500;
 read = “0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0?,
“x x x x x x x x o o o o o o o o”;
 
write = “1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0?,
“x x x x x x x x i i i i i i i i”;
 ;
 
memory “efuse”
size = 1;
 min_write_delay = 4500;
 max_write_delay = 4500;
 read = “0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0?,
“x x x x x x x x x x x x x o o o”;
 
write = “1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0?,
“x x x x x x x x x x x x x i i i”;
 ;
 
memory “lock”
size = 1;
 min_write_delay = 4500;
 max_write_delay = 4500;
 read = “0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0?,
“x x x x x x x x x x o o o o o o”;
 
write = “1 0 1 0 1 1 0 0 1 1 1 x x x x x”,
“x x x x x x x x 1 1 i i i i i i”;
 ;
 
memory “calibration”
size = 1;
 read = “0 0 1 1 1 0 0 0 0 0 0 x x x x x”,
“0 0 0 0 0 0 0 0 o o o o o o o o”;
 ;
 
memory “signature”
size = 3;
 read = “0 0 1 1 0 0 0 0 0 0 0 x x x x x”,
“x x x x x x a1 a0 o o o o o o o o”;
 ;
 ;

Yes that's a copy of the entry with id = "m328p";

I did that, exactly with the different desc="ATMEGA328";
and the suitable [b]signature = 0x1e 0x95 0x14;[/b] (see my first post here)

And I can run standalone avrdude to upload a sample sketch:

..\avrdude -v -p m328 -c usbtiny -U flash:w:.\MyBlink.cpp.hex:i

Here I use [b]-p m328[/b] to refer to this entry, but my Ardiuino ide runs its avrdude with a -patmega328p parameter when I use Upload using Programmer ( with Board and Programmer set correctly to the intended boards.txt and programmers.txt entries )

The IDE is still rather convenient and gives the impression it could handle that scenario ...
And I do not want to modify the original m328p entry.

What I did to the Boards.txt file was copied the entire UNO configuration and changed the name at the start of each line.

Mine looked like this -
##############################################################
uno328.name=Arduino328
uno328.upload.protocol=arduino
uno328.upload.maximum_size=32256
uno328.upload.speed=115200
uno328.bootloader.low_fuses=0xff
uno328.bootloader.high_fuses=0xde
uno328.bootloader.extended_fuses=0x05
uno328.bootloader.path=optiboot
uno328.bootloader.file=optiboot_atmega328.hex
uno328.bootloader.unlock_bits=0x3F
uno328.bootloader.lock_bits=0x0F
uno328.build.mcu=atmega328
uno328.build.f_cpu=16000000L
uno328.build.core=arduino
uno328.build.variant=standard

of course you will want to change the fuse and f_cpu line to match your settings.

In avrdude.conf I copied the entire ATmega328P section and changed all occurences of 328P to 328 along with the signature and it worked.

Thanks for your confirmation kf2qd !

changed all occurences of 328P to 328 along with the signature and it worked.

I rechecked that, thanks.

I learned that an avrdude part can be identified by either id or desc

In my conf file I added a part with id="m328";  desc="ATMEGA328"; and the correct signature

avrdude recognizes it:

C:\arduino-1.0.1\hardware\tools\avr>bin\avrdude -C etc\avrdude.conf -c usbtiny[b] -patmega328[/b]
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x1e9514
avrdude: safemode: Fuses OK
avrdude done.  Thank you.

Thus the boards.txt line
solo328.build.mcu=atmega328 * ### ( instead of atmega328p )*

should work well, too. However, arduino complains :

unknown MCU 'atmega328' specified
Known MCU names:
   avr2
   at90s2313

...

And this list of MCU names is different from what avrdude lists when calling avrdude -p xyz

avrdude: AVR Part "xyz" not found.
Valid parts are:
  t10  = ATtiny10        [etc\avrdude.conf:17068]
  t9   = ATtiny9         [etc\avrdude.conf:17024]
  t5   = ATtiny5         [etc\avrdude.conf:16980]
  t4   = ATtiny4         [etc\avrdude.conf:16936]
  ucr2 = 32UC3A0512      [etc\avrdude.conf:16915]
 ...
  m328 = ATMEGA328       [etc\avrdude.conf:9423]
  m328p = ATMEGA328P      [etc\avrdude.conf:9235]
 ...

Is there's a hidden extra config file additionally to the etc\avrdude.conf ?
I searched the whole disk for files called avr*.conf and avr*.rc but could not find one that serves as the source for ardiuno's list of known mcu's

Well, my issue is that I own and play with both atmega328 and atmega328p chips.
I could simply abuse one of the strange but matching names in both lists for my atmega328

Any comments anyone ?
BTW: If someone's interested: I sorted both lists by name and arranged them to show discrepancies. See attachment.

different part names.ods (14.8 KB)