Hi,
to program the flash I use the JTAG interface over a serial port.
I would set the fuse bytes to
lfuse 0x3F
hfuse 0x90
efuse 0xFF
by using stk500 and following command:
stk500 -dATmega128 -f903F -EFF
Verifying with command
stk500 -dATmega128 -F903F -GFF
shows following:
STK500 command line programmer, v 2.2 Atmel Corp (C) 2004-2005.
Scanning ports:
COM1 ... Port busy or STK500 not connected
COM2 ... Connected to STK500 V2 on port COM2
Device parameters loaded
Could not enter programming mode
Programming mode left
Connection to STK500 V2 closed
WARNING! One or more operations failed! Please examine the output
log above!
I have tried to set the fuse bytes also with another programmer avrdude
by using following command:
avrdude -p m128 -c stk500v2 -P COM2 -U hfuse:w:0x90:m
avrdude: AVR device initialized and ready to accept
instructions
Reading | | 0%
0.00savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
Reading | ################# | 33%
20.01savrdude: stk500_2_ReceiveMessage(): timeout
Reading | ################################################## | 100%
30.01s
avrdude: Device signature = 0x000000
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: current erase-rewrite cycle count is 252645135 (if being
tracked)
avrdude: reading input file "0x90"
avrdude: writing hfuse (1 bytes):
Writing | | 0%
0.00savrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
***failed;
Writing | ################################################## | 100%
80.04s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0x90:
avrdude: load data hfuse data from input file 0x90:
avrdude: input file 0x90 contains 1 bytes
avrdude: reading on-chip hfuse data:
Reading | | 0%
0.00savrdude: stk500_2_ReceiveMessage(): timeout
Reading | ################################################## | 100%
10.00s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x90 != 0x08
avrdude: verification error; content mismatch
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: safemode: hfuse changed! Was 90, and is now 8
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Here a timeout error is shown. Now the fuse bits have following values:
lfuse 0
hfuse 8
efuse 8
To get this I have entered following:
avrdude -p m128 -c stk500v2 -P COM2 -t -v
avrdude: Version 5.0
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
System wide configuration file is "P:\tools\win32\avrdude.conf"
Using Port : COM2
Using Programmer : stk500v2
AVR Part : ATMEGA128
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll
Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages
MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------
----- ----- ---------
eeprom 4 12 64 0 no 4096 8 0
9000 9000 0xff 0xff
flash 33 6 128 0 yes 131072 256 512
4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0
0 0 0 0x00 0x00
hfuse 0 0 0 0 no 1 0
0 0 0 0x00 0x00
efuse 0 0 0 0 no 1 0
0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0
0 0 0 0x00 0x00
calibration 0 0 0 0 no 4 0
0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0
0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel STK500 V2
Hardware Version: 14
Firmware Version: 50.49
Topcard : Unknown
Vtarget : 14.8 V
Varef : 14.9 V
Oscillator : 24.253 kHz
SCK period : 165.0 us
avrdude: AVR device initialized and ready to accept instructions
Reading | | 0%
0.00savrdude: stk500_2_ReceiveMess
age(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
Reading | ################# | 33%
20.01savrdude: stk500_2_ReceiveMe
ssage(): timeout
Reading | ################################################## | 100%
30.01s
avrdude: Device signature = 0x000000
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: safemode: lfuse reads as 0
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: safemode: hfuse reads as 8
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: safemode: efuse reads as 8
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: stk500_2_ReceiveMessage(): timeout
avrdude: current erase-rewrite cycle count is 252645135 (if being
tracked)
avrdude>
What can I do?
I don't know a way out.
Regards,
Thomas
|