Go Down

Topic: write bootloader with avrdude (Read 1 time) previous topic - next topic

mehel

Hey!

I am trying to convert the script provided with Arduino into a version working with avrdude (I am using an AVRISP mkII over USB from a MAC)

As the original script I am trying to write the lock bit first. The connection to the programmer and to the board seems to work ok, but somehow I am unable to write the lock bit.

It is always kind of annoying if the first step fails with ni real error report :)

Thanks


#######################################
Here is the command and output:
/usr/local/bin/avrdude -v -p m8 -b 115200 -P usb -c avrispmkII -U lock:w:0xff:m

avrdude: Version 5.1
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

        System wide configuration file is "/usr/local/etc/avrdude.conf"
        User configuration file is "/Users/michel/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port            : usb
        Using Programmer      : avrispmkII
        Overriding Baud Rate  : 115200
avrdude: usbdev_open(): Found AVRISP mkII, serno: 0000A0007237
        AVR Part              : ATMEGA8
        Chip Erase delay      : 10000 us
        PAGEL                 : PD7
        BS2                   : PC2
        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   128    0 no        512    0      0  9000  9000 0xff 0xff
          flash         33     6    64    0 yes      8192   64    128  4500  4500 0xff 0x00
          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
          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 AVR ISP mkII
        Hardware Version: 44
        Firmware Version: 1.1
        Topcard         : Unknown
        Vtarget         : 4.8 V
        Varef           : 4.8 V
        Oscillator      : 75.233 kHz
        SCK period      : 953.29 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.17s

avrdude: Device signature = 0x1e9307
avrdude: safemode: lfuse reads as DF
avrdude: safemode: hfuse reads as CA
avrdude: reading input file "0xff"
avrdude: writing lock (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;  
Writing | ################################################## | 100% 0.33s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xff:
avrdude: load data lock data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.09s

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

avrdude: safemode: lfuse reads as DF
avrdude: safemode: hfuse reads as CA
avrdude: safemode: Fuses OK

avrdude done.  Thank you.  


mehel

Ok, this one has been resolved by looking in the datasheet. The bits can only be set to 0 by a write operation. Setting it to 0xff requires a chip erase:

avrdude -e


Thanks!

Go Up