Custom board, how to change mcu signature?

Hi guys,

I'm trying to create a custom board on my Arduino IDE to use with a SPI programmer (Arduino as ISP).

I copied all code of "Arduino Duemilanove w/ ATmega328" from boards.txt and created mine.

The only problem that I have is that my MCU's signature is 0x1E 0x95 0x14 instead of 0x1E 0x97 0x03, which is the signature of the ATMEGA on arduino Duemilanove, and the only one that I could find on my avrdude.conf. So I also created another device on my avrdude.conf with the right signature.

My problem is that when I click upload the Arduino IDE calls avrdude with "-patmega328p", but I need it to be "-pmy328p" (my custom device). So I get an error: "Wrong microcontroler found".

I tried to change the "build.mcu" on my boards.txt but it also changes one parameter to the compiler and it stops working...

Is there a way to change the "-p" parameter to avrdude without changing the parameters of the compiler?

My files:
boards.txt

minimal.name=My Arduino minimal using Mega as ISP

minimal.upload.protocol=avrisp
minimal.upload.maximum_size=30720
minimal.upload.speed=19200

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

minimal.build.mcu=atmega328p
minimal.build.f_cpu=16000000L
minimal.build.core=arduino
minimal.build.variant=standard

avrdude.conf

#------------------------------------------------------------
# MyATmega328P
#------------------------------------------------------------

part
    id			= "my328p";
    desc		= "MyATMEGA328P";
    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		= 0x1E 0x95 0x14;
    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	= 0x53;
    predelay	= 1;
    postdelay	= 1;
    pollmethod	= 1;

    pp_controlstack =
	0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
	0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
	0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
	0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
    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		= 0x41;
	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		= 0x41;
	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";
    ;
;

Since you are using an ATmega328 instead of ATmega328p, change this line:

minimal.build.mcu=atmega328p

to

minimal.build.mcu=atmega328

You may have a problem if you burn and use the standard 328P bootloader (ATmegaBOOT_168_atmega328.hex) because it will answer "1E 97 03" (ATmeaga328P) when asked for the signature bytes. You may have to to use "Arduino Duemilanove w/ ATmega328" to use the bootloader.

johnwasser:
Since you are using an ATmega328 instead of ATmega328p, change this line:

minimal.build.mcu=atmega328p

to

minimal.build.mcu=atmega328

You may have a problem if you burn and use the standard 328P bootloader (ATmegaBOOT_168_atmega328.hex) because it will answer "1E 97 03" (ATmeaga328P) when asked for the signature bytes. You may have to to use "Arduino Duemilanove w/ ATmega328" to use the bootloader.

It didn't work.... The compiler does not recognize "atmega328" and it does not seem to have another option to atmega328, this is the output:

/home/belimawr/devel/Arduino/arduino-1.0.4/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328 -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=104 -I/home/belimawr/devel/Arduino/arduino-1.0.4/hardware/arduino/cores/arduino -I/home/belimawr/devel/Arduino/arduino-1.0.4/hardware/arduino/variants/standard /tmp/build6039195929985723321.tmp/Blink.cpp -o /tmp/build6039195929985723321.tmp/Blink.cpp.o 
unknown MCU 'atmega328' specified
Known MCU names:
   avr2
   at90s2313
   at90s2323
   at90s2333
   at90s2343
   attiny22
   attiny26
   at90s4414
   at90s4433
   at90s4434
   at90s8515
   at90c8534
   at90s8535
   avr25
   attiny13
   attiny2313
   attiny24
   attiny44
   attiny84
   attiny25
   attiny45
   attiny85
   attiny261
   attiny461
   attiny861
   attiny43u
   attiny48
   attiny88
   at86rf401
   avr3
   at43usb320
   at43usb355
   at76c711
   avr31
   atmega103
   avr35
   at90usb82
   at90usb162
   attiny167
   avr4
   atmega8
   atmega48
   atmega48p
   atmega88
   atmega88p
   atmega8515
   atmega8535
   atmega8hva
   at90pwm1
   at90pwm2
   at90pwm2b
   at90pwm3
   at90pwm3b
   avr5
   atmega16
   atmega161
   atmega162
   atmega163
   atmega164p
   atmega165
   atmega165p
   atmega168
   atmega168p
   atmega169
   atmega169p
   atmega32
   atmega323
   atmega324p
   atmega325
   atmega325p
   atmega3250
   atmega3250p
   atmega328p
   atmega329
   atmega329p
   atmega3290
   atmega3290p
   atmega406
   atmega64
   atmega640
   atmega644
   atmega644p
   atmega645
   atmega6450
   atmega649
   atmega6490
   atmega16hva
   at90can32
   at90can64
   at90pwm216
   at90pwm316
   atmega32m1
   atmega32c1
   atmega32u4
   at90usb646
   at90usb647
   at94k
   avr51
   atmega128
   atmega1280
   atmega1281
   atmega1284p
   at90can128
   at90usb1286
   at90usb1287
   avr6
   atmega2560
   atmega2561
   avrxmega5
   atxmega64a1
   avrxmega7
   atxmega128a1
   avr1
   at90s1200
   attiny11
   attiny12
   attiny15
   attiny28
Blink.cpp:1: error: MCU ‘atmega328’ supported for assembler only
In file included from /home/belimawr/devel/Arduino/arduino-1.0.4/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../avr/include/avr/pgmspace.h:82,
                 from /home/belimawr/devel/Arduino/arduino-1.0.4/hardware/arduino/cores/arduino/Arduino.h:8,
                 from Blink.ino:10:
/home/belimawr/devel/Arduino/arduino-1.0.4/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../avr/include/avr/io.h:330:6: warning: #warning "device type not defined"

I'm not planning to use the bootloader, my idea is to have a easy way to upload a sketch without the bootloader and using Arduino's IDE

The chip that I have is a ATMEGA328-PU.

Wow. I never suspected that AVRDUDE would not support the atmega328.

The easiest solution would be to go out and buy an ATmega328P.

Search the forum, I want to say other folks have gotten the ATmega328 working.

Thanks a lot guys!

johnwasser, this would be the easiest solution if I hadn't already bought a few atmega328 :frowning:

Jack Christensen, so far I could not find anything, but I'll keep looking.

Does it work to edit avrdude.conf, copy & paste the '328P section as a new '328 section with the signature bytes changed?