Subject: [Fwd: [avr-gcc-list] avrdude + avrstudio / stk500
/ ATMEGA162 - programming problems]



Forwarding to the avrdude-dev list where it's more on topic.

Eric

-------- Original Message --------
Subject: [avr-gcc-list] avrdude + avrstudio / stk500 / ATMEGA162 - programming problems
Date: Tue, 21 Dec 2004 15:17:53 +0100
From: Steve Bentley <[email protected]>
To: <[email protected]>



Hi,
Using avrdude to program my -162V part on the stk500 board I receive the
following:

////
avrdude -p atmega162 -P com1 -c stk500 -v -v -U flash:w:main.hex
avrdude: Version 4.4.0
Copyright (c) 2000-2004 Brian Dean, [email protected]

System wide configuration file is "C:\WinAVR\bin\avrdude.conf"

Using Port : com1
Using Programmer : stk500
AVR Part : ATMEGA162
Chip Erase delay : 9000 us
PAGEL : P00
BS2 : P00
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Memory Detail :

Page Polled
Memory Type Paged Size Size #Pages MinW MaxW ReadBack
----------- ------ ------ ---- ------ ----- ----- ---------
flash yes 16384 128 128 4500 4500 0xff 0xff
eeprom no 512 0 0 9000 9000 0xff 0xff
lfuse no 1 0 0 16000 16000 0x00 0x00
hfuse no 1 0 0 16000 16000 0x00 0x00
efuse no 1 0 0 16000 16000 0x00 0x00
lock no 1 0 0 16000 16000 0x00 0x00
signature no 3 0 0 0 0 0x00 0x00
calibration no 1 0 0 0 0 0x00 0x00

Programmer Type : STK500
Description : Atmel STK500
Hardware Version: 2
Firmware Version: 1.14
Vtarget : 5.0 V
Varef : 5.0 V
Oscillator : 3.686 MHz
SCK period : 1.1 us

avrdude: please define PAGEL and BS2 signals in the configuration file
for part ATMEGA162
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100%
0.01s

avrdude: Device signature = 0x1e9400
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be
performed
To disable this feature, specify the -D option.
avrdude: current erase-rewrite cycle count is 150994687 (if being
tracked)
avrdude: erasing chip
avrdude: please define PAGEL and BS2 signals in the configuration file
for part ATMEGA162
avrdude: reading input file "main.hex"
avrdude: input file main.hex auto detected as Intel Hex
avrdude: writing flash (1844 bytes):

Writing | ################################################## | 100%
0.60s

avrdude: 1844 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex auto detected as Intel Hex
avrdude: input file main.hex contains 1844 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100%
0.50s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x0c != 0x00
avrdude: verification error; content mismatch

avrdude done. Thank you.

make: *** [program] Error 1
////

I added the following PAGEL + BS2 to avrdude's config file. (Just copied
from the -161 part!!)
pagel = 0xd7;
bs2 = 0xa0;

But received the same output as before (obviously without the "avrdude:
please define PAGEL and BS2 signals in the configuration file for part
ATMEGA162" error message.

Perhaps this also sheds a clue on my problem?

////162 part description in avrdude's config file
#------------------------------------------------------------
# ATmega162
#------------------------------------------------------------

part
id = "m162";
desc = "ATMEGA162";
stk500_devcode = 0x83;
chip_erase_delay = 9000;
pagel = 0xd7;
bs2 = 0xa0;
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";

memory "flash"
paged = yes;
size = 16384;
page_size = 128;
num_pages = 128;
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 x 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 x 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";
;

memory "eeprom"
size = 512;
min_write_delay = 9000;
max_write_delay = 9000;
readback_p1 = 0xff;
readback_p2 = 0xff;

read = " 1 0 1 0 0 0 0 0",
" 0 0 x 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 x x x x a9 a8",
" a7 a6 a5 a4 a3 a2 a1 a0",
" i i i i i i i i";
;

memory "lfuse"
size = 1;
min_write_delay = 16000;
max_write_delay = 16000;
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 = 16000;
max_write_delay = 16000;

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 = 16000;
max_write_delay = 16000;

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 o o o o o 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 1 1 1 i i i i 1";
;

memory "lock"
size = 1;
min_write_delay = 16000;
max_write_delay = 16000;

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 "signature"
size = 3;

read = "0 0 1 1 0 0 0 0 0 0 x x x x
x x",
"x x x x x x a1 a0 o o o o o o
o o";
;

memory "calibration"
size = 1;

read = "0 0 1 1 1 0 0 0 0 0 x x x x x x",
"0 0 0 0 0 0 0 0 o o o o o o o o";
;
;
////

I then tried AVRStudio to program the part and received an error message
after the verify step.
BTW: If I erase the flash before programming using AVRStudio then after
reading the contents back again I read FF's but also some FE's!

////sample of reading flash part after erasure.
:10002000FFFEFFFFFEFFFFFFFEFFFFFFFEFFFFFFE4
:10003000FFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFD1
:10004000FFFFFFFFFFFEFFFFFFFFFFFFFFFEFFFFC2
:10005000FFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFB1
:10006000FFFEFFFFFFFEFFFFFFFEFFFFFFFFFFFFA3
////


Reading the devices signature (and cal byte) repeatedly gives new values
each time so I guess the root cause is that the flash is not being
programmed correctly.

I have the following jumper configuration on the stk board.

VTARGET = ON
AREF = ON
RESET = ON
XTAL1 = ON
OSCSEL = 1+2
BSEL2 = ON
PJUMP = OFF
ISP6PIN connected to SPROG3

I can program a AT90S8515 part successfully without any problems using
the above configuration but unfortunately can not with the 162 part.
TIA for any help!

Steve






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.820 / Virus Database: 558 - Release Date: 20.12.2004



_______________________________________________
avr-gcc-list mailing list
[email protected]
http://www.avr1.org/mailman/listinfo/avr-gcc-list




Programming list archiving by: Enterprise Git Hosting