Atmega4809 Fuse settings via arduino (boards.txt?)

Hello, i would like to set fuses in the arduino to use CRC and BOD, also i would like to do it from the IDE itself, afaik the m4809 based boards do have a debugger onboard so it should be possible to set fuses. while looking at the Datasheet i noticed lockbit has to be set to 0xC5 which i can not find in there anywere, I found the fuses.bin, but there is also no byte 0xC5, is the datasheet wrong? I would also maybe like to use the lockbit later on an thus would like to know how that works

could someone give me a example to change the boards.txt so that the fuses can be set?

i have tried this:

before:
nona4809.name=Arduino Nano Every

nona4809.vid.0=0x2341
nona4809.pid.0=0x0058

nona4809.upload.tool=avrdude
nona4809.upload.protocol=jtag2updi
nona4809.upload.maximum_size=49152
nona4809.upload.maximum_data_size=6144
nona4809.upload.speed=115200
nona4809.upload.use_1200bps_touch=true
nona4809.upload.extra_params=-P{serial.port}

nona4809.build.mcu=atmega4809
nona4809.build.f_cpu=16000000L
nona4809.build.board=AVR_NANO_EVERY
nona4809.build.core=arduino
nona4809.build.variant=nona4809
nona4809.build.text_section_start=.text=0x0
nona4809.build.extra_flags={build.328emulation} -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP
#nona4809.build.extra_flags=-B{runtime.tools.atpack.path}/gcc/dev/{build.mcu}

nona4809.bootloader.tool=avrdude
nona4809.bootloader.file=atmega4809_uart_bl.hex
nona4809.bootloader.BOOTEND=0x00
nona4809.bootloader.OSCCFG=0x01
nona4809.fuses.file=fuses_4809.bin
nona4809.bootloader.SYSCFG0=0xC9

After:
nona4809.name=Arduino Nano Every

nona4809.vid.0=0x2341
nona4809.pid.0=0x0058

nona4809.upload.tool=avrdude
nona4809.upload.protocol=jtag2updi
nona4809.upload.maximum_size=49152
nona4809.upload.maximum_data_size=6144
nona4809.upload.speed=115200
nona4809.upload.use_1200bps_touch=true
nona4809.upload.extra_params=-P{serial.port}

nona4809.build.mcu=atmega4809
nona4809.build.f_cpu=16000000L
nona4809.build.board=AVR_NANO_EVERY
nona4809.build.core=arduino
nona4809.build.variant=nona4809
nona4809.build.text_section_start=.text=0x0
nona4809.build.extra_flags={build.328emulation} -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP
#nona4809.build.extra_flags=-B{runtime.tools.atpack.path}/gcc/dev/{build.mcu}

nona4809.bootloader.tool=avrdude
nona4809.bootloader.file=atmega4809_uart_bl.hex
nona4809.bootloader.BOOTEND=0x00
nona4809.bootloader.OSCCFG=0x01
nona4809.fuses.file=fuses_4809.bin
nona4809.bootloader.SYSCFG0=0x09
nona4809.bootloader.LOCKBIT=0xC5
nona4809.bootloader.BODCFG=0xED

best regards

Take a look at the upload recipe in the platform.txt file:
https://github.com/arduino/ArduinoCore-megaavr/blob/1.8.7/platform.txt#L107

tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} {upload.verify} -p{build.mcu} -c{upload.protocol} {upload.extra_params}  -b{upload.speed} -e -D "-Uflash:w:{build.path}/{build.project_name}.hex:i" "-Ufuse2:w:{bootloader.OSCCFG}:m" "-Ufuse5:w:{bootloader.SYSCFG0}:m" "-Ufuse8:w:{bootloader.BOOTEND}:m" {upload.extra_files}

You can see that each of the existing fuse properties (bootloader.OSCCFG, bootloader.SYSCFG0, bootloader.BOOTEND are expanded in an avrdude command line flag. So if you are going to add new fuse properties in boards.txt then you also need to update the upload pattern in platform.txt, otherwise they won't do anything.

1 Like

hello in0 first of all thanks for the answer, could you please say me or better show me how i would do it? the boards.txt file ist that one generated by the download in boardmanager in appdata arduino15 packages....

thank you

That's correct. The boards.txt file contains the definitions for each board of the platform. The platform.txt file contains the compilation and upload command "patterns" for all the boards of the platform. You can open these files up in a text editor and change them as you like.

You can find all the documentation for the Arduino boards platform system here:
https://arduino.github.io/arduino-cli/latest/platform-specification/

An important thing to note is that you must restart the Arduino IDE before the changes you make the files will take effect.

Note that there are different platforms for different boards, so you must make sure you are modifying the files associated with the right board.
You can find the location for the currently selected board by examining the IDE's verbose compilation output:

  1. Select File > Preferences from the Arduino IDE's menus.
  2. Check the box next to "Show verbose output during: compilation".
  3. Click the OK button.
  4. Select Sketch > Verify/Compile from the Arduino IDE's menus.
  5. Wait for the compilation to finish.
  6. Click on the black console pane at the bottom of the Arduino IDE window.
  7. Scroll the pane all the way up to the top. There you will find a line that starts with "Using core...", something like this:
    Using core 'arduino' from platform in folder: 
    C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3
    
1 Like

Thank you, thats very helpful.

how can i test it the easyest way? uploading blinksketch with lockbit set to anything else than 0xC5 and then i would expect the IDE to error out because it can not verify but at the same time the M4809 should run.

or is there a way i can "read" out or see the effect from the fuses, i am a bit scared of playing with stuff like the Locksetting since i do not want to lock up the nano every

this as an example, okay i get that fuse2 is written to value of bootloader.OSCCFG, but what i did not understand at all now, sorry i guess thats a dumb question, where is "fuse2"? at address 0x02 and fuse3 is at address 0x03?

this i dont quite understand.

if i understand correctly the chip fuse for "LOCKBIT" has to be 0xC5 for the chip to be open, so i tried to find that value because that one is definetly known, however sadly this way of "drawing conclusions" did not work out for me and i would like to know for the future how to use the fuses.

You can learn about the avrdude command line options here:
https://www.nongnu.org/avrdude/user-manual/avrdude_4.html#Option-Descriptions

fuseN

The fuse bytes of ATxmega devices, N is an integer number for each fuse supported by the device.

1 Like

thanks a lot, i played with the settings a bit in form of the lockbit, however now i think i have managed to lock out the programmer...

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: jtagmkII_reset(): bad response to reset command: RSP_ILLEGAL_MCU_STATE
avrdude: initialization failed, rc=-1

the Fuses were last set as following

C:\Users\PC\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\PC\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega4809 -cjtag2updi -PCOM7 -b115200 -e -D -Uflash:w:C:\Users\PC\AppData\Local\Temp\arduino_build_995316/sketch_sep08a.ino.hex:i -Ufuse1:w:0xD4:m -Ufuse2:w:0x01:m -Ufuse5:w:0xC9:m -Ufuse8:w:0x00:m -Ulock:w:0xC5:m {upload.extra_files} 

FFuse one should configure 4V BOD, Lockbit is set according to Datasheet, remaining ones not touched yet. i can sadly no more upload, have even de- and re-installed the arduino nano every package

Is it somehow possible to do a "CHIPERASE"? the command for it should be avrdude -CC:\Users\PC\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -p atmega4809 -c jtag2updi -e -PCOM7 if i am right?

the nano every has a programmer onboard so it should work

thanks again for the help until now

0xD4 = 0b11010100
bit7 to 5 is BOD level but...

0b110 is undefined.
If want set to 4.3V, so 0x7 = 0b111

BOD entered a unstable behavior? :thinking:

okay, can i do anything to reset the chip? using arduinoIDE i can do nothing, no upload, no burn bootloader etc.

Chip erase doesn't clear fuse.
Either way, the chip needs to respond to the programmer to done chip erase...

how can i check if it does?

Use avrdude's option verbose output

e.g.
avrdude -c jtag2updi -P com7 -p atmega4809 -v -v -v -v

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is ""
avrdude: can't open config file "": Invalid argument
avrdude: error reading system wide configuration file ""

added conf file (-C path-to-file/file.conf)

         Using Port                    : com7
         Using Programmer              : jtag2updi
avrdude: jtagmkII_open_pdi()
avrdude: jtagmkII_getsync()
avrdude: jtagmkII_getsync(): Sending sign-on command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [00] . [00] . [01] . [00] . [00] . [00] . [0e] . [01] . [f3] . [97]
avrdude: jtagmkII_recv():
avrdude: ser_recv(): programmer is not responding
avrdude: jtagmkII_recv(): Timeout receiving packet
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): Sending sign-on command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [00] . [00] . [01] . [00] . [00] . [00] . [0e] . [01] . [f3] . [97]
avrdude: jtagmkII_recv():

My posts command is a sample and can't be used as is.
Write the other section yourself according to your environment.
Because I don't know the setup of your PC...
Please learn how to use AVRdude.

as you see above, i have added config file and the following output appears

Using Port                    : com7
         Using Programmer              : jtag2updi
avrdude: jtagmkII_open_pdi()
avrdude: jtagmkII_getsync()
avrdude: jtagmkII_getsync(): Sending sign-on command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [00] . [00] . [01] . [00] . [00] . [00] . [0e] . [01] . [f3] . [97]
avrdude: jtagmkII_recv():
avrdude: ser_recv(): programmer is not responding
avrdude: jtagmkII_recv(): Timeout receiving packet
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): Sending sign-on command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [00] . [00] . [01] . [00] . [00] . [00] . [0e] . [01] . [f3] . [97]
avrdude: jtagmkII_recv():
C:\Users\PC\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18\bin>avrdude -CC:\Users\PC\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18\etc\avrdude.conf -c jtag2updi -p m4809 -PCOM7 -v -v -v -v

avrdude: Version 6.3-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\PC\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18\etc\avrdude.conf"

         Using Port                    : COM7
         Using Programmer              : jtag2updi
avrdude: jtagmkII_open_pdi()
avrdude: jtagmkII_getsync()
avrdude: jtagmkII_getsync(): Sending sign-on command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [00] . [00] . [01] . [00] . [00] . [00] . [0e] . [01] . [f3] . [97]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [1d]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [86] . [01] . [01] . [07] . [01] . [01] . [01] . [07] . [06] . [01] . [00] . [00] . [00] . [00] . [00] . [00] J [4a] T [54] A [41] G [47] I [49] C [43] E [45]   [20] m [6d] k [6b] I [49] I [49] . [00]
avrdude: Recv: o [6f]
avrdude: Recv: V [56]

avrdude: jtagmkII_recv(): Got message seqno 0 (command_sequence == 0)
avrdude: Recv: . [86] . [01] . [01] . [07] . [01] . [01] . [01] . [07] . [06] . [01] . [00] . [00] . [00] . [00] . [00] . [00] J [4a] T [54] A [41] G [47] I [49] C [43] E [45]   [20] m [6d] k [6b] I [49] I [49] . [00]

Raw message:
0x86 0x01 0x01 0x07 0x01 0x01 0x01 0x07 0x06 0x01 0x00 0x00 0x00 0x00 0x00 0x00
0x4a 0x54 0x41 0x47 0x49 0x43 0x45 0x20 0x6d 0x6b 0x49 0x49 0x00
Sign-on succeeded

JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        1
  firmware version:              1.07
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.07
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
avrdude: jtagmkII_getsync(): Using a 298-byte device descriptor
avrdude: jtagmkII_setparm()
avrdude: jtagmkII_setparm(): Sending set parameter command (parm 0x03, 1 bytes):
avrdude: jtagmkII_send(): sending 3 bytes
avrdude: Send: . [1b] . [01] . [00] . [03] . [00] . [00] . [00] . [0e] . [02] . [03] . [06] $ [24] 1 [31]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: . [cd]
avrdude: Recv: . [83]

avrdude: jtagmkII_recv(): Got message seqno 1 (command_sequence == 1)
avrdude: Recv: . [80]

Raw message:
0x80
OK

avrdude: jtagmkII_getsync(): Sending get sync command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [02] . [00] . [01] . [00] . [00] . [00] . [0e] . [0f] . [e2] u [75]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [02]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: . [1d]
avrdude: Recv: . [09]

avrdude: jtagmkII_recv(): Got message seqno 2 (command_sequence == 2)
avrdude: Recv: . [80]

Raw message:
0x80
OK

         AVR Part                      : ATmega4809
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuses          0     0     0    0 no          9   10      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
avrdude: jtagmkII_getparm()
avrdude: jtagmkII_getparm(): Sending get parameter command (parm 0x01):
avrdude: jtagmkII_send(): sending 2 bytes
avrdude: Send: . [1b] . [03] . [00] . [02] . [00] . [00] . [00] . [0e] . [03] . [01] . [d3] . [99]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [03]
avrdude: Recv: . [00]
avrdude: Recv: . [03]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [81] . [01] . [01]
avrdude: Recv: . [ed]
avrdude: Recv: . [cd]

avrdude: jtagmkII_recv(): Got message seqno 3 (command_sequence == 3)
avrdude: Recv: . [81] . [01] . [01]

Raw message:
0x81 0x01 0x01
parameter values:
0x01  0x01

avrdude: jtagmkII_getparm()
avrdude: jtagmkII_getparm(): Sending get parameter command (parm 0x02):
avrdude: jtagmkII_send(): sending 2 bytes
avrdude: Send: . [1b] . [04] . [00] . [02] . [00] . [00] . [00] . [0e] . [03] . [02] . [aa] B [42]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [04]
avrdude: Recv: . [00]
avrdude: Recv: . [05]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [81] . [07] . [01] . [07] . [06]
avrdude: Recv: . [e6]
avrdude: Recv: M [4d]

avrdude: jtagmkII_recv(): Got message seqno 4 (command_sequence == 4)
avrdude: Recv: . [81] . [07] . [01] . [07] . [06]

Raw message:
0x81 0x07 0x01 0x07 0x06
parameter values:
0x07  0x01  0x07  0x06

         M_MCU hardware version: 1
         M_MCU firmware version: 1.07
         S_MCU hardware version: 1
         S_MCU firmware version: 6.07
         Serial number:          00:00:00:00:00:00
avrdude: jtagmkII_getparm()
avrdude: jtagmkII_getparm(): Sending get parameter command (parm 0x06):
avrdude: jtagmkII_send(): sending 2 bytes
avrdude: Send: . [1b] . [05] . [00] . [02] . [00] . [00] . [00] . [0e] . [03] . [06] s [73] I [49]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [05]
avrdude: Recv: . [00]
avrdude: Recv: . [03]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [81] . [88] . [13]
avrdude: Recv: x [78]
avrdude: Recv: M [4d]

avrdude: jtagmkII_recv(): Got message seqno 5 (command_sequence == 5)
avrdude: Recv: . [81] . [88] . [13]

Raw message:
0x81 0x88 0x13
parameter values:
0x88  0x13

         Vtarget         : 5.0 V

avrdude: jtagmkII_initialize(): trying to set baudrate to 115200
avrdude: jtagmkII_setparm()
avrdude: jtagmkII_setparm(): Sending set parameter command (parm 0x05, 1 bytes):
avrdude: jtagmkII_send(): sending 3 bytes
avrdude: Send: . [1b] . [06] . [00] . [03] . [00] . [00] . [00] . [0e] . [02] . [05] . [07] . [88] . [b0]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [06]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: . [c3]
avrdude: Recv: . [1f]

avrdude: jtagmkII_recv(): Got message seqno 6 (command_sequence == 6)
avrdude: Recv: . [80]

Raw message:
0x80
OK

avrdude: jtagmkII_set_devdescr(): Sending set device descriptor command:
avrdude: jtagmkII_send(): sending 299 bytes
avrdude: Send: . [1b] . [07] . [00] + [2b] . [01] . [00] . [00] . [0e] . [0c] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [80] . [00] @ [40] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [c0] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [80] . [01] . [00] . [00] . [00] . [00] . [00] . [01] . [02] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [e8] . [c8]
avrdude: jtagmkII_recv():
avrdude: ser_recv(): programmer is not responding
avrdude: jtagmkII_recv(): Timeout receiving packet

avrdude: jtagmkII_set_devdescr(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: jtagmkII_reset(): Sending reset command:
avrdude: jtagmkII_send(): sending 2 bytes
avrdude: Send: . [1b] . [07] . [00] . [02] . [00] . [00] . [00] . [0e] . [0b] . [01] . [f6] h [68]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [07]
avrdude: Recv: . [00]
avrdude: Recv: . [02]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5] . [83]
avrdude: Recv: . [03]
avrdude: Recv: . [fa]

avrdude: jtagmkII_recv(): Got message seqno 7 (command_sequence == 7)
avrdude: Recv: . [a5] . [83]

Raw message:
0xa5 0x83
Illegal MCU state

avrdude: jtagmkII_reset(): bad response to reset command: RSP_ILLEGAL_MCU_STATE
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: jtagmkII_close()
avrdude: jtagmkII_close(): Sending GO command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [08] . [00] . [01] . [00] . [00] . [00] . [0e] . [08] . [8e] ' [27]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [08]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: . [ce]
avrdude: Recv: / [2f]

avrdude: jtagmkII_recv(): Got message seqno 8 (command_sequence == 8)
avrdude: Recv: . [80]

Raw message:
0x80
OK

avrdude: jtagmkII_close(): Sending sign-off command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [09] . [00] . [01] . [00] . [00] . [00] . [0e] . [00] y [79] * [2a]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [09]
avrdude: Recv: . [00]
avrdude: Recv: . [02]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5] . [83]
avrdude: Recv: . [d6]
avrdude: Recv: ! [21]

avrdude: jtagmkII_recv(): Got message seqno 9 (command_sequence == 9)
avrdude: Recv: . [a5] . [83]

Raw message:
0xa5 0x83
Illegal MCU state

avrdude: jtagmkII_close(): bad response to sign-off command: RSP_ILLEGAL_MCU_STATE

avrdude done.  Thank you.

seems like the MCU is responding?

But all fuses 0x00? seems not correct at all. If i am right the only situations where this can happen is

  • WDT holds MCU in reset
  • CRC does not allow execution
  • BOD is holding MCU in reset
  • MCU is locked, but this should not be possible, since last upload hat the correct key i guess -Ulock:w:0xC5:m

some ideas or better a command how i can fully reset the device? standard PC setup. standard directorys.

i read Important: The only way to unlock a device is a CHIPERASE, which will erase all device memories to factory default so that no application data is retaine in the datasheet.... how is this done, how do i write USERROW with AVRDude?

thanks for any help

page 440 of the Datasheet:

Chip Erase
The following steps should be followed to issue a Chip Erase.
1. Enter the CHIPERASE KEY by using the KEY instruction. See Table 30-6 for the CHIPERASE signature.
2. Optional: Read the Chip Erase bit in the AS Key Status register (CHIPERASE in UPDI.ASI_KEY_STATUS) to
see that the KEY is successfully activated.
3. Write the Reset signature into the UPDI.ASI_RESET_REQ register. This will issue a System Reset.
4. Write 0x00 to the ASI Reset Request register (UPDI.ASI_RESET_REQ) to clear the System Reset.
5. Read the Lock Status bit in the ASI System Status register (LOCKSTATUS in UPDI.ASI_SYS_STATUS).
6. Chip Erase is done when LOCKSTATUS == 0 in UPDI.ASI_SYS_STATUS. If LOCKSTATUS == 1, go to point
5 again.
After a successful Chip Erase, the Lockbits will be cleared, and the UPDI will have full access to the system. Until
Lockbits are cleared, the UPDI cannot access the system bus, and only CS-space operations can be perform

so i think this is what i need to do, however can anyone hint me to the way i can do it?