Hi!
I've been experimenting with a few different programmers, and thought I'd add my STK500 as a programmer for the Arduino IDE. I got ISP programming working, but I have an issue when it comes to the high voltage parallel programming.
When a normal ISP adapter burns the bootloader, first it insert the unlock byte, set the fuses and burn the bootloader. the last thing it does is to write the lock bits. Then the ISP check if the high and low fuse bits are correct.
Now if I try to burn the bootloader with the STK500 as a high voltage parallel programmer, it also inserts the unlock bit, and tries to compare this with the one in the microcontroller. The programmer read this unlock bit as 0xff, and I get a content mismatch error:
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/user/Documents/Arduino/hardware/DIP-40/avr/avrdude.conf -v -patmega32 -cstk500pp -P /dev/cu.UC-232AC -e -Ulock:w:0x3f:m -Uhfuse:w:0xde:m -Ulfuse:w:0xa1:m
avrdude: Version 6.0.1, compiled on Apr 14 2015 at 16:30:25
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/Users/user/Documents/Arduino/hardware/DIP-40/avr/avrdude.conf"
User configuration file is "/Users/user/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/cu.UC-232AC
Using Programmer : stk500pp
AVR Part : ATmega32
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 10 64 0 no 1024 4 0 9000 9000 0xff 0xff
flash 33 6 64 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
lock 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00
Programmer Type : STK500PP
Description : Atmel STK500 V2 in parallel programming mode
Programmer Model: STK500
Hardware Version: 2
Firmware Version Master : 2.10
Topcard : Unknown
Vtarget : 4.8 V
SCK period : 8.7 us
Varef : 4.7 V
Oscillator : 1.229 MHz
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9502
avrdude: erasing chip
avrdude: reading input file "0x3f"
avrdude: writing lock (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3f:
avrdude: load data lock data from input file 0x3f:
avrdude: input file 0x3f contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0xff != 0x3f
avrdude: verification error; content mismatch
avrdude done. Thank you.
Error while burning bootloader.
There are my programmers.txt settings:
stk500.name=STK500 as ISP
stk500.communication=serial
stk500.protocol=stk500
stk500.program.protocol=stk500
stk500.program.tool=avrdude
stk500.program.extra_params= -P {serial.port}
stk500hvpp.name=STK500 as HVPP
stk500hvpp.communication=serial
stk500hvpp.protocol=stk500pp
stk500hvpp.program.protocol=stk500pp
stk500hvpp.program.tool=avrdude
stk500hvpp.program.extra_params= -P {serial.port}
How can I set the correct lock bit (0x0f) with the programmer?