Coder Social home page Coder Social logo

eltangas / jtag2updi Goto Github PK

View Code? Open in Web Editor NEW
319.0 26.0 91.0 724 KB

UPDI programmer software for Arduino (targets Tiny AVR-0/1/2, Mega AVR-0 and AVR-DA/DB MCUs)

License: MIT License

Batchfile 3.71% C++ 90.50% Shell 3.62% C 2.17%
updi avrdude programmer firmware arduino attiny817 attiny1617 mcu target-mcu atmel-avr

jtag2updi's Introduction

jtag2updi

This is a firmware, that when uploaded on an atmega328p, or a similar AVR MCU (including experimental support for atmega1280/2560, and for Logic Green LGT8F328P/D AVR clones with 32 pins or more), enables it to interface with avrdude using the jtagice Mk2 protocol via a serial link. In particular, you can use an Arduino Uno/Nano to host this firmware (experimental support for Arduino Mega and LGT based Arduino clones). It provides a bridge to program the new attiny817 family of MCUs, that use the UPDI interface:

avrdude -> HW Serial interface -> Programmer MCU (e.g. Mega328P) -> SW Serial on PD6 -> Target MCU (e.g. tiny817)

Currently, I have not tested this software with a level shifter, however, since the UPDI pin is high voltage tolerant, it's ok to have V_prog > V_target, but not the reverse. Warning: only the UPDI pins of devices that support high voltage programming should be assumed to be high voltage tolerant. This is not the case for the MegaAVR 0-series or AVR-DA series! However, the current injection spec for I/O pins on these parts is far more generous that it is for older AVR devices it is not clear if the UPDI pin is included in this.

Notice, however, that the logic levels need to be compatible for successful programming: V_target cannot be lower than about 60% of V_prog (60% will likelly work, 70% is guaranteed to work). Therefore, it will not be possible to program a 2.5V target with a 5.0V programmer, because communication errors will surely occur (but no electrical damage), but if V_target is 3.3V (66% of 5.0V) chances are good.

                                            V_prog                 V_target
                                              +-+                     +-+
                                               |                       |
 +----------+          +---------------------+ |                       | +--------------------+
 | PC       |          | Programmer          +-+                       +-+  Target            |
 | avrdude  |          |                     |      +----------+         |                    |
 |       TX +----------+ RX              PD6 +------+   4k7    +---------+ UPDI               |
 |          |          |                     |      +----------+         |                    |
 |       RX +----------+ TX                  |                           |                    |
 |          |          |                     |                           |                    |
 |          |          |                     |                           |                    |
 |          |          |                     +--+                     +--+                    |
 +----------+          +---------------------+  |                     |  +--------------------+
             JTAGICE MkII                      +-+     UPDI          +-+
             Protocol                          GND     Protocol      GND

Drawing adapted from: https://github.com/mraardvark/pyupdi

If you use an Arduino as host for this program, be sure that, after burning the software, you disable its auto-reset feature, using one of the techniques described here: https://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection

Alternatively, you can use an Arduino without integrated USB/serial adapter, like the pro-mini; in that case, just disconecting the DTR wire will disable the auto-reset. Just remember the UPDI chip must be connected to the same supply voltage as the Arduino's MCU!

Building with avr-gcc

To build, run the make.bat file, after editing it with the following options:

  1. path of AVR-GCC on your system
  2. correct target MCU
  3. Frequency at which your MCU is running (F_CPU, defaults to 16MHz)
  4. Baud rate of UPDI link (UPDI_BAUD, defaults to 225 kbaud)

I provide a makefile suitable for a MS-Windows environment, but I'm sure Linux users can manage.

There are also pre-built files on the "build" directory. They were built using avr-gcc 8.0.1 compiled for MinGW by sprintersb: https://sourceforge.net/projects/mobilechessboar/files/avr-gcc%20snapshots%20%28Win32%29/

The pre-built hex file is for ATMega 328P@16MHz; to use a different MCU of the same family, like the mega168, or running at a frequency different from 16MHz, you will need to rebuild.

When building for Logic Green AVR clones, select "atmega328p" as target. The macro ARDUINO_AVR_LARDU_328E must also be defined, either in the "sys.h" file (using #define) or in the gcc command line (by adding -DARDUINO_AVR_LARDU_328E). This allows the code to know the target is a LGT chip, and set the chip core speed at run time from F_CPU. Recommended values for F_CPU are 32MHz or 16MHz; 8MHz also works but is less reliable.

Building with Arduino IDE

If you prefer, the program can be built as if it was an Arduino sketch. Inside the "source" directory, there is an empty file called "jtag2updi.ino" so that the Arduino IDE can recognize the source code.

Just copy all the files inside "source" to a new directory called "jtag2updi" inside your sketch main directory.

The Arduino IDE will automatically set the correct MCU model and F_CPU, but if you want to change the speed of the UPDI link, you will have to edit UPDI_BAUD directly in the source code.

When building for Logic Green AVR clones, I recommend that you install the board definitions from dbuezas (https://github.com/dbuezas/lgt8fx).

This version allows selection of the MCU running speed, unlike the official release (Larduino_HSP)

Note: By default, the following pins are used for UPDI communication on common Arduino boards:

  • Arduino Mega (1280/2560): PD3 -> Digital Pin 18
  • Arduino (328P): PD6 -> Digital Pin 6

Using with avrdude

You will find a modified avrdude.conf file in the base folder. This is based on the current avrdude.conf file from: http://svn.savannah.gnu.org/viewvc/*checkout*/avrdude/trunk/avrdude/avrdude.conf.in?revision=1422

It has been modified to work with avrdude 6.3, by removing (actually, commenting out) some incompatible stuff, and adding the "jtag2updi" programmer type.

The definitions for UPDI chips were slightly modified so that avrdude thinks they use the PDI programming interface instead of UPDI (i.e., avrdude thinks they are some kind of XMegas).

This allows the jtagice mk2 protocol to be used for programming UPDI chips, since this protocol predates UPDI and is not formally compatible with it. Originally, I had planed to use the STK500v2 protocol, and emulate the ISP interface, and I actually wrote an ISP version of the programmer software.

However, this would require entirely new definitions for the UPDI chips inside the avrdude.conf file, while using jtagice2 requires only very slight changes to the definions provided by Atmel (now Microchip).

Note: If you install the Arduino board "Nano Every" in your Arduino IDE, it will come with versions of avrdude and avrdude.conf files that support jtag2updi. You can use those files instead of the compatibility avrdude.conf supplied here which is meant for older avrdude versions.

Jtagice mk2 is the most advanced of Atmel's programming protocols that still supports a UART serial connection instead of USB, making it easily compatible with any Arduino you choose to host this software, and any OS you run avrdude on.

It's major limitation is speed; it can't go over 115200 Baud, because the protocol lacks definitions for higher speeds. It's actually inferior to the STK500v2 protocol in this respect, this older standard can run at any speed avrdude instructs it to.

Fortunately, the current UPDI chips do not have very large flash memories, so I think this isn't a major issue.

Example command line (windows):

avrdude -c jtag2updi -P com7 -p t1614

If all the connections are correct and the target is indeed an unlocked tiny1614, the output will be:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x1e9422 (probably t1614)

avrdude done.  Thank you.

If the chip is locked, the output will be:

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(): bad response to sign-off command: RSP_ILLEGAL_MCU_STATE

avrdude done.  Thank you.

To unlock the chip, you need to erase it, using the -e option on avrdude:

avrdude -c jtag2updi -P com7 -p t1614 -e

Alternatively, you can erase the chip from interactive mode, enter it using "-t", and "-F" to override the error: Note: You must build with DISABLE_HOST_TIMEOUT defined for terminal mode to work. See below for more information on the timeouts.

avrdude -c jtag2updi -P com7 -p t1614 -t -F

You will enter the avrdude prompt:

avrdude: jtagmkII_reset(): bad response to reset command: RSP_ILLEGAL_MCU_STATE
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0xffff00
avrdude: Expected signature for ATtiny1614 is 1E 94 22
avrdude: NOTE: Programmer supports page erase for Xmega devices.
         Each page will be erased before programming it, but no chip erase is performed.
         To disable page erases, specify the -D option; for a chip-erase, use the -e option.
avrdude>

Enter "erase" then "quit" and the chip will be unlocked (and erased).

avrdude> erase
>>> erase
avrdude: erasing chip
avrdude> quit
>>> quit

avrdude done.  Thank you.

Extra information

If you call avrdude with -v -v -v -v (maximum verbosity) so you see all the data sent back, it will add

Debug channel

Regardless of what AVR you are running it on, you can enable SPI debugging in sys.h (see commented out examples) - this outputs data on SPI that is meant to be converted to serial on another board - this debug channel allows you to get something approxiomating a serial port to print debug info to on parts without a second USART On parts with multiple USARTS, you can just use that for debugging (similarly, there are commented out examples). Both print the same data. In dbg.h, you can enable extended information for most UPDI calls.

Timeouts

Previous versions of jtag2updi could get hung up waiting for a target that wasn't working (for example, because it was connected incorrectly) or the host (for example, if you entered a slow command, like reading a 128k flash memory when you didn't intend to, and ctrl-c hoping to "save time"), requiring a reset to reconnect to it. This version has timeouts on communication with both the host (250ms - it gives up and assumes the host isn't going to sat anything after three timeouts, and awaits a fresh session from avrdude), and when talking to the target (100ms - which is far more time than the target should ever take to respond). In the event of a timeout communicating with the target, it will return RSP_NO_TARGET_POWER response. The host timeout of course prevents terminal mode from working (target timeout should just prevent hangs without downside) Both can be disabled by uncommenting #define DISABLE_TARGET_TIMEOUT and/or #define DISABLE_HOST_TIMEOUT in sys.h - the latter should uncommented if terminal mode is to be used, and should remain commented out if terminal mode will not be used.

Supported parts

jtag2updi was tested on tinyAVR 0-series and 1-series and ATmega 328p/168p. It is expected to work on classic megaAVR x8, x4, x1, and x0 parts, as well as megaAVR 0-series and AVR-DA parts.

Using with AVR JTAG ICE usb stick

The code can be used with the compact AVR JTAG ICE usb stick available to buy online from various sources.

See Tools section of the project on how to prepare and use the stick.

Troubleshooting

If you have triple-checked all the connections but still getting errors, the problem might be the speed of the serial links. I have set the jtag2updi entry on the avrdude configuration file to run at 115200 baud by default. This baud rate can cause errors if, for example, your MCU is running at 8MHz.

This can be changed with the avrdude "-b" option. Valid baud rates are 2400, 4800, 9600, 14400, 19200, 38400, 57600 and 115200. You can make the setting permanent by editing the jtag2updi entry on "avrdude.conf".

If the trouble is on the UPDI link, a slower speed can be selected by changing UPDI_BAUD and recompiling. You can also try to use the alternate bit banging USART by setting UPDI_IO_TYPE to 2. You will find these and other configuration settings in the "sys.h" header file.

Sometimes, the programmer can become irresponsive, in that case it should be reset.

Contact the author

I usually lurk around in the AVRFreaks forum. If you have questions/suggestions/etc. about this program, please post to this thread:

https://www.avrfreaks.net/forum/updi-programmer-software-arduino-compatible-avrdude

For serious problems with the code, like bugs, please open a github issue.

jtag2updi's People

Contributors

cbalint13 avatar eltangas avatar ghz2000 avatar mcudude avatar serisman avatar simonmerrett avatar spencekonde avatar vonnieda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jtag2updi's Issues

Using JTAG2UPDI to inject NVMPROG key

Hi!

A while ago I made a small PCB that basically lets you use an Arduino Pro Micro as an mEDBG programmer. It's a nice programmer, but it sucks that the firmware is closed source.

Optiboot support for the new mega0/tiny0/tiny1 series is starting to mature, but as you may already know, Optiboot uses the RST pin to enter bootloader mode in order to upload code. This is perfectly fine on mega0's, but on the tiny0/1's the RST pin is shared with UPDI. This means that you'll have to "lock yourself out" if you want to use a bootloader for uploading.

And thus the need for a 12V programmer occurs. Sadly, Microchip's documentation is lagging behind; and it turns out that the "newer" tiny0/tiny1's needs a 12V pulse before receiving the NVMPROG key within 65ms. This is nearly impossible difficult to do manually.

I was hoping to design a board where I can just push a button to re-enable the UDPI interface. When I push the button a ~500us pulse has to be injected to the UPDI line, and the NVMPROG key also has to be sent from some device within 65ms.

I was hoping to achieve this with as little hardware as possible. A small microcontroller could drive a voltage multiplier to generate 12V, read the pushbutton, time the 12V pulse and hopefully "inject" the NVMPROG key. Then we can run Avrdude without having to worry about the timeout anymore IIRC.

The question is: How can I use this project to just establish communication with the target (after the 12V pulse) and inject the NVMPROG key? And can this be done with an 8-pin ATtiny(25/45/85) if I remove all the hardware UART related stuff?

Thanks!

JTAG2UPDI on Attiny1614

Hi,

It worked the first few times then it stopped working all of the sudden. I didn't touch the fuses so far. Any idea what it may be?

Command:
avrdude -v -v -v -v -F -c jtag2updi -P COM5 -p attiny1614 -U flash:w:$Attiny1614teste.hex:i

Result:


avrdude.exe: 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 "C:\Users\robso\Downloads\attiny\attinyMega\jtag2updi\avrdude.conf"

             Using Port                    : COM5
             Using Programmer              : jtag2updi
avrdude.exe: jtagmkII_open_pdi()
avrdude.exe: jtagmkII_getsync()
avrdude.exe: jtagmkII_getsync(): Sending sign-on command: 
avrdude.exe: jtagmkII_send(): sending 1 bytes
avrdude.exe: Send: . [1b] . [00] . [00] . [01] . [00] . [00] . [00] . [0e] . [01] . [f3] . [97] 
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [1d] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [86] . [01] . [01] . [00] . [06] . [01] . [01] . [00] . [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.exe: Recv: < [3c] 
avrdude.exe: Recv: . [7f] 

avrdude.exe: jtagmkII_recv(): Got message seqno 0 (command_sequence == 0)
avrdude.exe: Recv: . [86] . [01] . [01] . [00] . [06] . [01] . [01] . [00] . [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 0x00 0x06 0x01 0x01 0x00 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:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
avrdude.exe: jtagmkII_getsync(): Using a 298-byte device descriptor
avrdude.exe: jtagmkII_setparm()
avrdude.exe: jtagmkII_setparm(): Sending set parameter command (parm 0x03, 1 bytes): 
avrdude.exe: jtagmkII_send(): sending 3 bytes
avrdude.exe: Send: . [1b] . [01] . [00] . [03] . [00] . [00] . [00] . [0e] . [02] . [03] . [06] $ [24] 1 [31] 
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [01] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [01] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [80] 
avrdude.exe: Recv: . [cd] 
avrdude.exe: Recv: . [83] 

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

Raw message:
0x80 
OK

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

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

Raw message:
0x80 
OK

             AVR Part                      : ATtiny1614
             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    0      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         32   32      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      16384   64      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   32      0     0     0 0x00 0x00

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

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

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

avrdude.exe: jtagmkII_getparm()
avrdude.exe: jtagmkII_getparm(): Sending get parameter command (parm 0x02): 
avrdude.exe: jtagmkII_send(): sending 2 bytes
avrdude.exe: Send: . [1b] . [04] . [00] . [02] . [00] . [00] . [00] . [0e] . [03] . [02] . [aa] B [42] 
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [04] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [05] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [81] . [00] . [06] . [00] . [06] 
avrdude.exe: Recv: . [ca] 
avrdude.exe: Recv: . [db] 

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

Raw message:
0x81 0x00 0x06 0x00 0x06 
parameter values:
0x00  0x06  0x00  0x06  

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

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

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

             Vtarget         : 5.0 V

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

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

Raw message:
0x80 
OK

avrdude.exe: jtagmkII_set_devdescr(): Sending set device descriptor command: 
avrdude.exe: jtagmkII_send(): sending 299 bytes
avrdude.exe: 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] @ [40] . [00]   [20] . [00] . [00] . [00] . [00] . [00] . [00] . [00] @ [40] . [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] . [01] . [00] . [00] . [00] . [00] . [00] . [01] . [02] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] 5 [35] g [67] 
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [07] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [01] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [80] 
avrdude.exe: Recv: | [7c] 
avrdude.exe: Recv: . [9e] 

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

Raw message:
0x80 
OK

avrdude.exe: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude.exe: jtagmkII_reset(): Sending reset command: 
avrdude.exe: jtagmkII_send(): sending 2 bytes
avrdude.exe: Send: . [1b] . [08] . [00] . [02] . [00] . [00] . [00] . [0e] . [0b] . [01] . [de] . [fe] 
avrdude.exe: jtagmkII_recv():
avrdude.exe: ser_recv(): programmer is not responding
avrdude.exe: jtagmkII_recv(): Timeout receiving packet

avrdude.exe: jtagmkII_reset(): timeout/error communicating with programmer (status -1)
avrdude.exe: initialization failed, rc=-1
avrdude.exe: AVR device initialized and ready to accept instructions
avrdude.exe: Device signature = 0x666c61
avrdude.exe: Expected signature for ATtiny1614 is 1E 94 22
avrdude.exe: NOTE: Programmer supports page erase for Xmega devices.
             Each page will be erased before programming it, but no chip erase is performed.
             To disable page erases, specify the -D option; for a chip-erase, use the -e option.
avrdude.exe: jtagmkII_close()
avrdude.exe: jtagmkII_close(): Sending GO command: 
avrdude.exe: jtagmkII_send(): sending 1 bytes
avrdude.exe: Send: . [1b] . [08] . [00] . [01] . [00] . [00] . [00] . [0e] . [08] . [8e] ' [27] 
avrdude.exe: jtagmkII_recv():
avrdude.exe: ser_recv(): programmer is not responding
avrdude.exe: jtagmkII_recv(): Timeout receiving packet

avrdude.exe: jtagmkII_close(): timeout/error communicating with programmer (status -1)
avrdude.exe: jtagmkII_close(): Sending sign-off command: 
avrdude.exe: jtagmkII_send(): sending 1 bytes
avrdude.exe: Send: . [1b] . [08] . [00] . [01] . [00] . [00] . [00] . [0e] . [00] . [c6] . [ab] 
avrdude.exe: jtagmkII_recv():
avrdude.exe: ser_recv(): programmer is not responding
avrdude.exe: jtagmkII_recv(): Timeout receiving packet

avrdude.exe: jtagmkII_close(): timeout/error communicating with programmer (status -1)

avrdude.exe done.  Thank you.

ATtiny1607 at 8MHz with Arduino IDE

Hi. I'm using the Arduino core megaTinyCore from SpenceKonde to compile the code with the Arduino IDE for an ATtiny1607. At 20MHz and 16MHz, everything's OK but below that, it compiles but it's not working. F_CPU is set correctly. At 8 or 10MHz, I need to double the baud rate of the host to be able to communicate with the program but it blocks when it tries to communicate with the target.

Any idea of the problem?

Thanks

Which parts support NVM version 2?

Hi All,

I wonder which parts support NVM version 2? I have checked the code and found the NVM version depends on flash pagesize.
nvm_version = (flash_pagesize >= 256) ? 2 : 1;

But after glancing over those datasheets, even the largest size-mounted flash parts like ATtiny3224/3226/3227 only implemented with flash pagesize 128Bytes. So anyone knows which parts support NVM verson 2/ flash page size >= 256 bytes. Thanks in advance.

ATtiny402 signatures

This issue has been partly raised in this thread, independently of jtag2updi and I am now experiencing it combined with an avrdude.conf issue with jtag2updi.

I am a complete novice when it comes to command line operation of avrdude and am slowly getting closer to baremetal, so please go easy if I am making major errors.

Setup: jtag2updi is built using Arduino IDE 1.8.9 and loaded on an Arduino Nano clone with an ATMEGA328P and CH340G USB-Serial converter onboard. 5V VCC and GND are connected between both the Nano and pins 1 and 8 respectively on the ATtiny402. The ATtiny402 is on a SOIC8 to 0.1" header breakout in a breadboard. There's a 4.7k Ohm resistor between Nano pin D6 and pin 6 / PA0 on the ATtiny402. I have installed avrdude v6.3 and have renamed the original avrdude.conf to OLDavrdude.conf and copied the avrdude.conf provided in the jtag2updi repo into the avrdude folder.

I then run this command with avrdude in the command line:
C:\avrdude>avrdude -c jtag2updi -P com5 -p t402
and get the response:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.30s

avrdude: Device signature = 0x1e9225 (probably t406)
avrdude: Expected signature for ATtiny402 is 1E 92 23

avrdude done.  Thank you. 

Firstly, I believe the avrdude.conf should be using correct device signature for ATtiny402 as 1E 92 27:
image

The second problem is that the device signature is incorrect in the physical chip! May I suggest an additional entry in the jtag2updi version of avrdude.conf along the lines of:

#------------------------------------------------------------
# ATtiny402w = workaround to address wrong device signature on some chips
#------------------------------------------------------------

part parent    ".avr8x_tiny"
    id        = "t402w";
    desc      = "ATtiny402w";
    signature = 0x1E 0x92 0x25;

    memory "flash"
        size      = 0x1000;
        offset    = 0x8000;
        page_size = 0x40;
        readsize  = 0x100;
    ;

    memory "eeprom"
        size      = 0x80;
        offset    = 0x1400;
        page_size = 0x20;
        readsize  = 0x100;
    ;
;

Thanks for bearing with me. I'm happy to submit a pull request with the edits (datasheet-correct device signature for the 402 and the new 402w entry) but I wanted to check that this makes sense with much more experienced and competent people like @ElTangas, @cbalint13 etc.

Where exactly does the UPDI transmission start and end in the code?

Hello,

first of all, thanks for maintaining the code. However, it is difficult to keep track of the flow of the actual code. :-) So I have to ask where in the code does the UPDI transmission start and end exactly?

I moved the switching on and off of the programming led.
I moved "on" to the beginning of enter_progmode() and "off" to the end of go(). But the beginning of the transmission is still missing.

Where exactly does the UPDI transmission start and end?

https://www.directupload.net/file/d/5855/hz7c22vr_png.htm

Change Programmer Pin

How can we change to programming pin from D6 to B4? Is it as easy as setting the UPDI_PORT & UPDI_PIN variables?

RSP_ILLEGAL_MCU_STATE after setting WDTCFG fuse

When I change the WDTCFG fuse to something different from 0x00 through the command:

avrdude -c jtag2updi -P com4 -p attiny412 -U fuse0:w:0x00:m -v

It seems that the MCU goes to a lock state. Below is what I receive for any further command:

avrdude -c jtag2updi -P com4 -p attiny412 -U flash:w:"mylocalpath\myfile.hex":i

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.

In order to avoid this inconvenience, I have to set the WDTCFG fuse back to 0x00, thus disable the WDT.
Is it a known issue?

Thank you for your support

avrdude on Raspberry Pi not working (programming an ATtiny3217)

Hi,
First of all: Thanks for this great repo!
On a Raspberry Pi I'm trying to upload a precompiled program to an ATtiny3217. Unfortunately it does not work. Main error is:
avrdude: jtagmkII_initialize(): part ATtiny3217 has no PDI interface
I use the same upload instructions as Arduino 1.8.10 does:
avrdude -Cavrdude.conf -v -V -pattiny3217 -cjtag2updi -P/dev/ttyUSB0 -Uflash:w:Demo.ino.hex:i
This works fine on my macOS machine though.

Reading the device signature out of the ATtiny3217 always gives different results.
avrdude -Cavrdude.conf -F -v -V -pattiny3217 -cjtag2updi -P/dev/ttyUSB0

First try:

avrdude: Device signature = 0x78b1f2
avrdude: Expected signature for ATtiny3217 is 1E 95 22

Second try:

avrdude: Device signature = 0x7841fc
avrdude: Expected signature for ATtiny3217 is 1E 95 22

Third try:

avrdude: Device signature = 0x78a1a3
avrdude: Expected signature for ATtiny3217 is 1E 95 22

(avrdude version 6.3)

JICE_io::flush() is brittle

It only works if you know there is a transfer in progress when you call it.

If there isn't, it will clear the bit, and then wait forever for a transaction that isn't happening to set it again...

(this is one of the things I'm fixing in the version I plan to submit hopefully today - needed to get it working in the case where you don't know if there's something being transferred in order to get a debugging channel opened from a '3216 - I flush, swap serial to the alt pins, output debug info, flush again, and swap the pins back)

Can't program with verify without power-cycle on DxCore (AVR32DD14)

I've tested on a Arduino-ProMini with CH340 with your code and SpenceKonde's fork - same problem:

Command-line:
/home/stefan/.arduino15/packages/DxCore/tools/avrdude/6.3.0-arduino17or18/bin/avrdude -C/home/stefan/.arduino15/packages/DxCore/hardware/megaavr/1.5.3/avrdude.conf -v -pavr32dd14 -cjtag2updi -P/dev/ttyUSB0 -Ufuse5:w:0b11011001:m -Ufuse6:w:0b00001100:m -Ufuse7:w:0x00:m -Ufuse8:w:0x00:m -Uflash:w:/tmp/arduino_build_610810/Blink.ino.hex:i

1st - programming / writing is OK: (only last line)

Writing | ################################################## | 100% 0.25s

avrdude: 790 bytes of flash written

2nd when the verify begins:

avrdude: verifying flash memory against /tmp/arduino_build_610810/Blink.ino.hex:
avrdude: load data flash data from input file /tmp/arduino_build_610810/Blink.ino.hex:
avrdude: input file /tmp/arduino_build_610810/Blink.ino.hex contains 790 bytes
avrdude: reading on-chip flash data:

Reading | avrdude: jtagmkII_paged_load(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_paged_load(): bad response to read memory command: RSP_NO_TARGET_POWER
#########################avrdude: jtagmkII_recv(): msglen 167772161 exceeds max message size 100000, ignoring message
avrdude: jtagmkII_recv(): msglen 167772161 exceeds max message size 100000, ignoring message
avrdude: jtagmkII_recv(): msglen 167772161 exceeds max message size 100000, ignoring message
avrdude: jtagmkII_recv(): msglen 167772161 exceeds max message size 100000, ignoring message

avrdude: jtagmkII_read_byte(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_read_byte(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_read_byte(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_read_byte(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_read_byte(): fatal timeout/error communicating with programmer (status -1)
avr_read(): error reading address 0x0000
    read operation not supported for memory "flash"
avrdude: failed to read all of flash memory, rc=-2
avrdude: jtagmkII_program_disable(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_close(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_close(): timeout/error communicating with programmer (status -1)

avrdude done.  Thank you.

After that the DUT stops working and the ProMini has to power-cycle and all work again.
Verify without programming, after that, also works. Any ideas?

The programmer is not able to unbrick locked tinyAVR MCU at all

Good day!

I mean the MCU having lock byte set. At least when using avrdude.

The reason is code of JTAG2::enter_progmode(). Briefly: this code is not working completely if the MCU is in "locked" state even using HV-programmer.

Please give me few days to rewrite the function in a way it can handle "locked MCU" condition correctly.

Best regards,
Alexey

Error in avrdude.conf file!

When I put the avrdude.conf file inside avrdude folder and try to program, it shows the following!

: avrdude -u -c jtag2updi -P COM6 -p m8
WARNING: Unable to detect MCU

avrdude.exe: error at C:\Program Files (x86)\AVRDUDESS\avrdude.conf:1115: programmer type jtagice3_updi not found
avrdude.exe: error reading system wide configuration file "C:\Program Files (x86)\AVRDUDESS\avrdude.conf"

How to solve this?

Thanks!

modified avrdude.conf has errors

Hey ElTangas,

It seems like the avrdude.conf provided with this repository has a few issues on my pc (arch linux with Avrdude installed from Pacman).

I get the following error (the config file is called old.conf):
$ avrdude -C old.conf -c jtag2updi -P /dev/ttyUSB0 -p t402 -U flash:w:test.hex
avrdude: error at old.conf:1115: programmer type jtagice3_updi not found
avrdude: error reading system wide configuration file "old.conf"

To fix this issue I got rid of any programmer of the jtagice3_updi type (including snap_updi). Now I get the following error:
$ avrdude -C old.conf -c jtag2updi -P /dev/ttyUSB0 -p t402 -U flash:w:test.hex
avrdude: error at old.conf:15183: syntax error
avrdude: error reading system wide configuration file "old.conf"

To fix this error I had to remove every decleration of ocd_base.
After these changes, everything runs great.

getting started

Hey, thanks for providing this firmware.

At the moment I'm struggling to get this working using a mac although I'm sure whatever I'm doing wrong is something blindingly obvious.

These are the steps I've taken:

  1. install avrdude via homebrew (it installs version 6.3 successfully)
  2. overwrite /usr/local/Cellar/avrdude/6.3/etc/avrdude.conf with modified version provided in jtag2updi
  3. put files in jtag2updi/source into new directory called jtag2updi and upload to arduino using the arduino ide
  4. connect 10uF capacitor to RST and GND pins on the arduino nano, connect UPDI of tiny1616 to arduinos D6 via 4.7k resistor & connect ground/power to each other
  5. run "avrdude -c jtag2updi -P /dev/cu.wchusbserial20 -p t1616"

this is the result I get:

avrdude: jtagmkII_reset(): timeout/error communicating with programmer (status -1)
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: jtagmkII_close(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_close(): timeout/error communicating with programmer (status -1)

avrdude done. Thank you.

I believe the firmware c++ files have been uploaded correctly to the nano as the arduino ide says "done uploading" with the following report:

Sketch uses 3262 bytes (10%) of program storage space. Maximum is 30720 bytes.
Global variables use 528 bytes (25%) of dynamic memory, leaving 1520 bytes for local variables. Maximum is 2048 bytes.
and the arduinos light is blinking during the upload process.

I've tried a 120Ohm resistor on power and reset instead in case that was the issue to no avail.
The port name is the same as in the Arduino IDE, I've tried using tty.* instead of cu.* to no avail there either.
Just to be thorough I've tried a different arduino nano and restarting the mac also to no avail.

Any ideas for what to try next would be greatly appreciated. Thanks

Port manipulation issue/question

Maybe not an issue, but why do you do this?

        /* Enable all UPDI port pull-ups */   
        PORT(UPDI_PORT) = 0xFF;
        /* Enable all LED port pull-ups, except for the LED pin */   
        PORT(LED_PORT) = 0xFF - (1 << LED_PIN);

Also, as an aside, on XTINY (ahem, tinyAVR 0-series and 1-series), as well as megaAVR 0-series) that doesn't even do what the comment says, as the pullup is controlled by the PINnCTRL register instead...

Definitely not intended behavior:
You have an LED_PORT and LED_PIN - but you never set DDR for it so it never turns on - it looks like you meant to do that here?

        /* Enable LED */   
        PORT(LED_PORT) |= (1 << LED_PIN);

Bloody hell, it took me like half a dozen edits to get linebreaks into the code blocks!

Arduino Nano Every as programmer

Thanks for the great repository! I do not have an issue, but a question. I am wondering whether it will also work with an Arduino Nano Every (ATMEGA4809) instead of an Arduino Nano as a programmer.

Porting to Atmega16(L).

Hi @ElTangas !

Would like to ask a little bit of help related to the subject, will detail below.

  1. There are some very cute USB sticks which could run jtag2updi like these AVR-ICE Clones, comming with a little atmega16L chip, CH340 usb-serial and have some HC245 buffers (not all useful for UPDI, but can be avoided).

  2. The device come with a burnt in bootloader that is actice for a few seconds at boot time, so i managed to write a simple python script that is able to flash/read (.hex) anything in these little USB sticks without touching the electronics/pcb at all.

The problem

a. In order to port on atmega16l timer1 or timer2 should be used and timer0 should to be avoided.

b. Unfortunate is that even on original atmega328p (on a plain arduino uno) timer1 and timer2 variants gets me to "Illegal MCU State" but timer0 always works !

c. Obviously, since i am unable to make it work with timer1 or timer2 on original 328p cant make it on atmel16.

The request

If have some little time can look into why timer1 and timer2 variants of original code leads to wrong "Illegal MCU state" ?

I prepared here all the code for all three variants of timer usage HERE. Obviously I spent lot of time figuring out why 1:1 same code works well with timer0 and why fails e.g. on timer2 (perfectly similar) on the very same 328p board.

ToDo

  • Would it be possible to use TimerX with ISR() ? That would allow to control any pin not only dedicated OCRX pins. I wasnt able to make such setup and lack of a good digital analyser hardened the task a lot.

Status LED feature

For some reason the Status LED is off when initially turned on, then after a successful programming, the LED comes on and stays on. We are batch programming and would be nice if the status led goes back off at the start of a new programming session.

AVR JTAG ICE no voltage on VTref

I followed the instructions to update the firmware for the AVR JTAG ICE and connected the ATtiny1616 following your schematic. AVRDUDE is not recognizing the ATtiny1616 and it seems there is no voltage on VTref to power the target. It all works great after using an external 5V source. I tried Vsupply (pin#7) as well, but the voltage drops below 1.8V as soon as it connects to the ATtiny1616. Any suggestions on how to power the microcontroller from the AVR JTAG ICE?

JTAG2UPDI on Atmega32U4 (Arduino Leonardo, micro etc)

I have some ATtiny202 around to play with - and some 'micro pro' with 32U4 on. So I thought to use ElTangas jtag2updi to program those.

He gave me the tip to have a look at the ATmega4809 with SAMD11 used for USB. So it seemed just to be minor changes. I added those. After adding 'include Arduino.h' it compiled without errors, but doesn't seem to start after having done the transfer.
jice.zip

Unable to program ATMega4809

Hi

I am trying to program ATMega4809 on a custom PCB but it does not seem to work. I have a I2C OLED display that I am getting to work. I tried the example sketch but it does not work. I think that the program is not uploading. Do I need to do anything to unlock the chip before programming? Thanks in advance. Please below log.

Sketch uses 19939 bytes (40%) of program storage space. Maximum is 49152 bytes.
Global variables use 181 bytes (2%) of dynamic memory, leaving 5963 bytes for local variables. Maximum is 6144 bytes.
C:\Users\Vijay\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\Vijay\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10/avrdude.conf -v -patmega4809 -cjtag2updi -PCOM4 -Uflash:w:C:\Users\Vijay\AppData\Local\Temp\arduino_build_478200/test1.ino.with_bootloader.hex:i -Ufuse0:w:0x00:m -Ufuse1:w:0x14:m -Ufuse2:w:0x02:m -Ufuse4:w:0x00:m -Ufuse5:w:0b11001001:m -Ufuse6:w:0x06:m -Ufuse7:w:0x00:m -Ufuse8:w:0x00:m -Ulock:w:0xC5:m

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\Vijay\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10/avrdude.conf"

     Using Port                    : COM4
     Using Programmer              : jtag2updi

JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
boot-loader FW version: 1
firmware version: 6.00
hardware version: 1
S_MCU:
boot-loader FW version: 1
firmware version: 6.00
hardware version: 1
Serial number: 00:00:00:00:00:00
Device ID: JTAGICE mkII
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
       prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
       fuses          0     0     0    0 no          9    0      0     0     0 0x00 0x00
       fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse8          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
       data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
       usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
       flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
       eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

     Programmer Type : JTAGMKII_PDI
     Description     : JTAGv2 to UPDI bridge
     M_MCU hardware version: 1
     M_MCU firmware version: 6.00
     S_MCU hardware version: 1
     S_MCU firmware version: 6.00
     Serial number:          00:00:00:00:00:00
     Vtarget         : 5.0 V

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9651 (probably m4809)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "C:\Users\Vijay\AppData\Local\Temp\arduino_build_478200/SW1.0_HW2.4_70by50mm.ino.with_bootloader.hex"
avrdude: writing flash (19940 bytes):

Writing | ################################################## | 100% 3.84s

avrdude: 19940 bytes of flash written
avrdude: verifying flash memory against C:\Users\Vijay\AppData\Local\Temp\arduino_build_478200/SW1.0_HW2.4_70by50mm.ino.with_bootloader.hex:
avrdude: load data flash data from input file C:\Users\Vijay\AppData\Local\Temp\arduino_build_478200/SW1.0_HW2.4_70by50mm.ino.with_bootloader.hex:
avrdude: input file C:\Users\Vijay\AppData\Local\Temp\arduino_build_478200/SW1.0_HW2.4_70by50mm.ino.with_bootloader.hex contains 19940 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.83s

avrdude: verifying ...
avrdude: 19940 bytes of flash verified
avrdude: reading input file "0x00"
avrdude: writing fuse0 (1 bytes):

Writing | ################################################## | 100% 0.01s

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

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

avrdude: verifying ...
avrdude: 1 bytes of fuse0 verified
avrdude: reading input file "0x14"
avrdude: writing fuse1 (1 bytes):

Writing | ################################################## | 100% 0.01s

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

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse1 verified
avrdude: reading input file "0x02"
avrdude: writing fuse2 (1 bytes):

Writing | ################################################## | 100% 0.01s

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

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse2 verified
avrdude: reading input file "0x00"
avrdude: writing fuse4 (1 bytes):

Writing | ################################################## | 100% 0.01s

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

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

avrdude: verifying ...
avrdude: 1 bytes of fuse4 verified
avrdude: reading input file "0b11001001"
avrdude: writing fuse5 (1 bytes):

Writing | ################################################## | 100% 0.01s

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

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse5 verified
avrdude: reading input file "0x06"
avrdude: writing fuse6 (1 bytes):

Writing | ################################################## | 100% 0.01s

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

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse6 verified
avrdude: reading input file "0x00"
avrdude: writing fuse7 (1 bytes):

Writing | ################################################## | 100% 0.01s

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

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse7 verified
avrdude: reading input file "0x00"
avrdude: writing fuse8 (1 bytes):

Writing | ################################################## | 100% 0.01s

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

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of fuse8 verified
avrdude: reading input file "0xC5"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

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

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude done. Thank you

Question: programing atmega4809 chips?

Hi,

In a project where im using atmega4809 in a custom pcb, i just broke my pickit 4 programmer.
I wonder if i can use the jtag2udpi in my Arduino Uno, as a replacement?

Question: can this firmware be used for programing atmega4809 chips?

Unstable trailing edge of stopbit pulse while using software UPDI I/O

Good day!

Earlier I spent some time trying to make working UPDI HV mini programmer that I'd made using slightly modified schematics. I'd investigated that updi_io_soft.cpp contains an error (at my sight) that leads to either unstable or completely failed programmer operating.

The problem is that at stop bit transmission UPDI pin is switched to input mode (line 225, updi_io_soft.cpp) just after it has set to "1" (line 214, updi_io_soft.cpp). The trailing edge of the stop bit might not be detected by target device due to very short positive pulse that is damping completely as a fact because of parasitic capacitances. I think it's an issue.

I suggest to add some delay after stop bit transmission. I'm not sure but it seems to be reasonable for me to append the same time as "0" pulse has (txdelay).

At least in my environment the modification has led to stable operating of my UPDI programmer.

This patch is included.
0001-Fixes-unstable-trailing-edge-of-stopbit-pulse-while-using-software-UPDI-IO.txt

Best regards,
Alexey

UPDI programming with level translation

Thanks again for your work on jtag2updi!

In the README.md you mention you haven't tried using a level shifter -- I thought I'd share my results/issues here and maybe add a suggestion.

In all cases I use atmega328p as the programmer, and attiny1614 as the target MCU.
The programmer (atmega328p) is running at 5V, and I'm level-shifting down to 2.5V on the target.

Level translation with TXB0104
This one seems to work just fine both at max UPDI_BAUD (225k) and min (80k).
TXB0104 chip is an auto-direction-sensing translator, intended for push-pull applications.

I tried it with the series resistor (on UPDI line) on both side of the translator, on either one side, as well as neither side - works in all combinations.

Level translation with PI4ULS
The full name is PI4ULS5V201 (datasheet) - could NOT get it to work, no matter what I tried. Which is a shame, because it's a small single-channel auto-direction-sensing translator.
The datasheet for it claims support for 20Mbit/s for push-pull (should more than enough) and 2Mbit/s for open-drain applications.

This IC has integrated 10k pull-up resistors - could this be throwing off the UPDI protocol? On the other hand, it does claim to support push-pull applications in any case (not sure how that works with pull-ups).

I also tried recompiling jtag2updi to reduce UPDI_BAUD to minimum (80k) -- still no luck.

I've verified that the translator IC itself appears to function as expected by manually connecting either side to VCC/GND with a jumper cable and observing correct change on the other side (I've done this on the PCB itself, i.e. physically same IC).

I've attached logs of avrdude -v -v -v ... runs with TXB0104 (working) and PI4ULS (not working) in case this gives you any clue:
logs-txb0104-new.txt
logs-pi4uls-new.txt

Feature request: expose data direction on a separate output pin?
I've generally found auto-direction sensing translators can be finicky, where as translators with a DIR pin seem more reliable (also faster and cheaper).
I'm wondering if we could have jtag2updi expose "current data direction" on a pin, which could then be hooked up to the DIR pin on the translator -- this would allow more parts to choose from. Any thoughts about this?

One would probably need 2 data direction pins of opposite polarity, actually (to support all configurations).

Verify Flash after Programming

Hello,

does your "programmer" do a real reading check after writing? "Verify Flash after Programming.
Or does he just write without any check?

Building fail for Arduino Leonardo/ProMicro (Atmega32u4)

I knew I'd have issues while trying to upload my code using Pro Mico as UPDI programmer, but I didn't think I'd have issues programming the programmer itself!
While compiling in Arduino IDE 1.8 for any of the boards (Leonardo, Pro Micro, Fio v3, ...) all having Atmega32U4 chip, returns this ERROR:

Compiling 'jtag2updi' for 'Arduino Leonardo'
Error compiling project sources
 
 
Build failed for project 'jtag2updi'
sys.cpp:10: In file included from
io.h:99: In file included from
JICE_io.cpp:9: from
 
 
sys.cpp: In function void SYS::init()
JICE_io.cpp: In function uint8_t JICE_io::put(char)
 
 
sys.h: 55:27: error: 'PORTUPDI_PORT' was not declared in this scope
sys.h: 346:32: error: 'UCSRHOST_USARTA' was not declared in this scope
   # define PORT(x) CONCAT(PORT,x)
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
sys.h:39: note  in definition of macro CONCAT
sys.h:40: note  in expansion of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
   #define XCONCAT(A,B) CONCAT(A,B)        \\ expand and concatenate
sys.cpp:38: note  in expansion of macro PORT
   ^~~~~~
   PORT(UPDI_PORT) = 1<<UPDI_PIN
sys.h:346: note  in expansion of macro XCONCAT
   ^~~~
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
   ^~~~~~~
 
JICE_io.cpp:59: note  in expansion of macro HOST_UCSRA
   loop_until_bit_is_set(HOST_UCSRA, UDRE)
 
updi_io_soft.cpp:10: In file included from
   ^~~~~~~~~~
sys.cpp: 38:26: error: 'UPDI_PIN' was not declared in this scope
sys.h:346: note  suggested alternative  HOST_UCSRA
   PORT(UPDI_PORT) = 1<<UPDI_PIN
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
   ^~~~~~~~
sys.h:40: note  in expansion of macro CONCAT
sys.cpp:38: note  suggested alternative  USB_PID
   #define XCONCAT(A,B) CONCAT(A,B)        \\ expand and concatenate
   PORT(UPDI_PORT) = 1<<UPDI_PIN
 
   ^~~~~~
   ^~~~~~~~
sys.h:346: note  in expansion of macro XCONCAT
   USB_PID
updi_io_soft.cpp: In function uint8_t UPDI_io::get()
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
   ^~~~~~~
 
JICE_io.cpp:59: note  in expansion of macro HOST_UCSRA
 
sys.cpp:10: In file included from
   loop_until_bit_is_set(HOST_UCSRA, UDRE)
sys.h: 56:26: error: 'DDRUPDI_PORT' was not declared in this scope
   ^~~~~~~~~~
   # define DDR(x) CONCAT(DDR,x)
sys.h:39: note  in definition of macro CONCAT
 
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h: 56:26: error: 'DDRLED_PORT' was not declared in this scope
 
updi_io_soft.cpp:54: note  in expansion of macro DDR
   # define DDR(x) CONCAT(DDR,x)
   DDR(UPDI_PORT)  &= ~(1 << UPDI_PIN)
sys.h: 333:26: error: 'UDREHOST_USART' was not declared in this scope
sys.h:39: note  in definition of macro CONCAT
   ^~~
   #define UDRE XCONCAT(UDRE, HOST_USART)
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:40: note  in expansion of macro CONCAT
sys.cpp:42: note  in expansion of macro DDR
   #define XCONCAT(A,B) CONCAT(A,B)        \\ expand and concatenate
   DDR(LED_PORT) |= (1 << LED_PIN)
   ^~~~~~
   ^~~
sys.h:333: note  in expansion of macro XCONCAT
   #define UDRE XCONCAT(UDRE, HOST_USART)
 
   ^~~~~~~
JICE_io.cpp:59: note  in expansion of macro UDRE
 
updi_io_soft.cpp: 54:35: error: 'UPDI_PIN' was not declared in this scope
   loop_until_bit_is_set(HOST_UCSRA, UDRE)
   DDR(UPDI_PORT)  &= ~(1 << UPDI_PIN)
sys.cpp: 42:26: error: 'LED_PIN' was not declared in this scope
   ^~~~
   ^~~~~~~~
   DDR(LED_PORT) |= (1 << LED_PIN)
sys.h:333: note  suggested alternative  HOST_UCSRA
updi_io_soft.cpp:54: note  suggested alternative  USB_PID
   ^~~~~~~
   #define UDRE XCONCAT(UDRE, HOST_USART)
   DDR(UPDI_PORT)  &= ~(1 << UPDI_PIN)
sys.h:40: note  in expansion of macro CONCAT
   ^~~~~~~~
   #define XCONCAT(A,B) CONCAT(A,B)        \\ expand and concatenate
   USB_PID
   ^~~~~~
sys.h:333: note  in expansion of macro XCONCAT
 
   #define UDRE XCONCAT(UDRE, HOST_USART)
   ^~~~~~~
sys.cpp:10: In file included from
JICE_io.cpp:59: note  in expansion of macro UDRE
   loop_until_bit_is_set(HOST_UCSRA, UDRE)
 
   ^~~~
 
updi_io_soft.cpp:10: In file included from
sys.cpp: In function void SYS::setLED()
 
 
JTAG2.h:12: In file included from
sys.h: 55:27: error: 'PORTUPDI_PORT' was not declared in this scope
JICE_io.h:13: from
   # define PORT(x) CONCAT(PORT,x)
JICE_io.cpp:10: from
 
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h: 55:27: error: 'PORTLED_PORT' was not declared in this scope
updi_io_soft.cpp:56: note  in expansion of macro PORT
   # define PORT(x) CONCAT(PORT,x)
   PORT(UPDI_PORT) &= ~(1 << UPDI_PIN)
sys.h:39: note  in definition of macro CONCAT
   ^~~~
   #define CONCAT(A,B) A##B                \\ concatenate
 
sys.cpp:58: note  in expansion of macro PORT
   PORT(LED_PORT) |= 1 << LED_PIN
sys.h: 338:25: error: 'TXCHOST_USART' was not declared in this scope
   ^~~~
   #define TXC XCONCAT(TXC, HOST_USART)
sys.h:39: note  in definition of macro CONCAT
 
   #define CONCAT(A,B) A##B                \\ concatenate
 
sys.h:338: note  in expansion of macro XCONCAT
io.h:99: In file included from
   #define TXC XCONCAT(TXC, HOST_USART)
sys.cpp: 58:26: error: 'LED_PIN' was not declared in this scope
sys.h:11: from
   ^~~~~~~
   PORT(LED_PORT) |= 1 << LED_PIN
updi_io_soft.cpp:10: from
JICE_io.cpp:60: note  in expansion of macro TXC
   ^~~~~~~
   HOST_UCSRA|=1<<TXC
   ^~~
 
 
sys.h:338: note  suggested alternative  HOST_UCSRA
sys.h: 54:26: error: 'PINUPDI_PORT' was not declared in this scope
sys.cpp:10: In file included from
   #define TXC XCONCAT(TXC, HOST_USART)
   # define PIN(x) CONCAT(PIN,x)
sys.h:39: note  in definition of macro CONCAT
sys.h:54: note  in expansion of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
   # define PIN(x) CONCAT(PIN,x)
sys.h:338: note  in expansion of macro XCONCAT
   ^~~~~~
   #define TXC XCONCAT(TXC, HOST_USART)
updi_io_soft.cpp:102: note  in expansion of macro PIN
 
   ^~~~~~~
   [uart_port] "i" (_SFR_IO_ADDR(PIN(UPDI_PORT)))
JICE_io.cpp:60: note  in expansion of macro TXC
sys.cpp: In function void SYS::clearLED()
   ^~~
   HOST_UCSRA|=1<<TXC
   ^~~
 
 
sys.h: 55:27: error: 'PORTLED_PORT' was not declared in this scope
updi_io_soft.cpp:10: In file included from
 
   # define PORT(x) CONCAT(PORT,x)
sys.h:39: note  in definition of macro CONCAT
sys.h: 348:30: error: 'UDRHOST_USART' was not declared in this scope
   #define CONCAT(A,B) A##B                \\ concatenate
   #define HOST_UDR XCONCAT(UDR, HOST_USART)
sys.cpp:62: note  in expansion of macro PORT
sys.h:39: note  in definition of macro CONCAT
   PORT(LED_PORT) &= ~(1 << LED_PIN)
   #define CONCAT(A,B) A##B                \\ concatenate
 
   ^~~~
sys.h:348: note  in expansion of macro XCONCAT
updi_io_soft.cpp: In function uint8_t UPDI_io::put(char)
   #define HOST_UDR XCONCAT(UDR, HOST_USART)
   ^~~~~~~
JICE_io.cpp:61: note  in expansion of macro HOST_UDR
 
 
   return HOST_UDR = c
sys.cpp: 62:28: error: 'LED_PIN' was not declared in this scope
sys.h: 56:26: error: 'DDRUPDI_PORT' was not declared in this scope
   ^~~~~~~~
   PORT(LED_PORT) &= ~(1 << LED_PIN)
   # define DDR(x) CONCAT(DDR,x)
sys.h:348: note  suggested alternative  HOST_UCSRA
   ^~~~~~~
sys.h:39: note  in definition of macro CONCAT
   #define HOST_UDR XCONCAT(UDR, HOST_USART)
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:39: note  in definition of macro CONCAT
updi_io_soft.cpp:175: note  in expansion of macro DDR
   #define CONCAT(A,B) A##B                \\ concatenate
   DDR(UPDI_PORT) |= (1 << UPDI_PIN)
sys.h:348: note  in expansion of macro XCONCAT
   ^~~
   #define HOST_UDR XCONCAT(UDR, HOST_USART)
   ^~~~~~~
JICE_io.cpp:61: note  in expansion of macro HOST_UDR
 
   return HOST_UDR = c
   ^~~~~~~~
updi_io_soft.cpp: 175:33: error: 'UPDI_PIN' was not declared in this scope
   DDR(UPDI_PORT) |= (1 << UPDI_PIN)
   ^~~~~~~~
 
updi_io_soft.cpp:175: note  suggested alternative  USB_PID
JICE_io.cpp:10: In file included from
   DDR(UPDI_PORT) |= (1 << UPDI_PIN)
   ^~~~~~~~
   USB_PID
 
JICE_io.cpp: In function uint8_t JICE_io::get()
 
io.h:99: In file included from
 
sys.h:11: from
updi_io_soft.cpp:10: from
sys.h: 346:32: error: 'UCSRHOST_USARTA' was not declared in this scope
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
JICE_io.h:18: note  in definition of macro loop_until_bit_set_or_host_timeout
 
   checkTimeouts() & WAIT_FOR_HOST)))
sys.h: 55:27: error: 'PORTUPDI_PORT' was not declared in this scope
   ^~~~~~~~
   # define PORT(x) CONCAT(PORT,x)
sys.h:40: note  in expansion of macro CONCAT
sys.h:55: note  in expansion of macro CONCAT
   #define XCONCAT(A,B) CONCAT(A,B)        \\ expand and concatenate
   # define PORT(x) CONCAT(PORT,x)
   ^~~~~~
   ^~~~~~
sys.h:346: note  in expansion of macro XCONCAT
updi_io_soft.cpp:220: note  in expansion of macro PORT
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
   [uart_port] "i" (_SFR_IO_ADDR(PORT(UPDI_PORT)))
   ^~~~~~~
   ^~~~
JICE_io.cpp:72: note  in expansion of macro HOST_UCSRA
   loop_until_bit_set_or_host_timeout(HOST_UCSRA, RXC)
   ^~~~~~~~~~
 
sys.h:346: note  suggested alternative  HOST_UCSRA
updi_io_soft.cpp:10: In file included from
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
JICE_io.h:18: note  in definition of macro loop_until_bit_set_or_host_timeout
   checkTimeouts() & WAIT_FOR_HOST)))
 
   ^~~~~~~~
sys.h:40: note  in expansion of macro CONCAT
updi_io_soft.cpp: In function void send_break()
   #define XCONCAT(A,B) CONCAT(A,B)        \\ expand and concatenate
   ^~~~~~
sys.h:346: note  in expansion of macro XCONCAT
 
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
sys.h: 56:26: error: 'DDRUPDI_PORT' was not declared in this scope
   ^~~~~~~
   # define DDR(x) CONCAT(DDR,x)
JICE_io.cpp:72: note  in expansion of macro HOST_UCSRA
sys.h:39: note  in definition of macro CONCAT
   loop_until_bit_set_or_host_timeout(HOST_UCSRA, RXC)
   #define CONCAT(A,B) A##B                \\ concatenate
   ^~~~~~~~~~
updi_io_soft.cpp:236: note  in expansion of macro DDR
   DDR(UPDI_PORT) |= (1 << UPDI_PIN)
   ^~~
 
sys.h: 337:25: error: 'RXCHOST_USART' was not declared in this scope
 
   #define RXC XCONCAT(RXC, HOST_USART)
JICE_io.h:18: note  in definition of macro loop_until_bit_set_or_host_timeout
updi_io_soft.cpp: 236:33: error: 'UPDI_PIN' was not declared in this scope
   checkTimeouts() & WAIT_FOR_HOST)))
   DDR(UPDI_PORT) |= (1 << UPDI_PIN)
   ^~~~~~
   ^~~~~~~~
sys.h:40: note  in expansion of macro CONCAT
updi_io_soft.cpp:236: note  suggested alternative  USB_PID
   #define XCONCAT(A,B) CONCAT(A,B)        \\ expand and concatenate
   DDR(UPDI_PORT) |= (1 << UPDI_PIN)
   ^~~~~~
   ^~~~~~~~
sys.h:337: note  in expansion of macro XCONCAT
   USB_PID
   #define RXC XCONCAT(RXC, HOST_USART)
   ^~~~~~~
JICE_io.cpp:72: note  in expansion of macro RXC
 
   loop_until_bit_set_or_host_timeout(HOST_UCSRA, RXC)
updi_io_soft.cpp:10: In file included from
   ^~~
sys.h:337: note  suggested alternative  HOST_UCSRA
 
   #define RXC XCONCAT(RXC, HOST_USART)
JICE_io.h:18: note  in definition of macro loop_until_bit_set_or_host_timeout
sys.h: 55:27: error: 'PORTUPDI_PORT' was not declared in this scope
   checkTimeouts() & WAIT_FOR_HOST)))
   # define PORT(x) CONCAT(PORT,x)
   ^~~~~~
sys.h:39: note  in definition of macro CONCAT
sys.h:40: note  in expansion of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
   #define XCONCAT(A,B) CONCAT(A,B)        \\ expand and concatenate
updi_io_soft.cpp:243: note  in expansion of macro PORT
   ^~~~~~
   PORT(UPDI_PORT) &= ~(1 << UPDI_PIN)
sys.h:337: note  in expansion of macro XCONCAT
   ^~~~
   #define RXC XCONCAT(RXC, HOST_USART)
   ^~~~~~~
JICE_io.cpp:72: note  in expansion of macro RXC
   loop_until_bit_set_or_host_timeout(HOST_UCSRA, RXC)
   ^~~
 
JTAG2.h:12: In file included from
JICE_io.h:13: from
JICE_io.cpp:10: from
 
sys.h: 348:30: error: 'UDRHOST_USART' was not declared in this scope
   #define HOST_UDR XCONCAT(UDR, HOST_USART)
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:348: note  in expansion of macro XCONCAT
   #define HOST_UDR XCONCAT(UDR, HOST_USART)
   ^~~~~~~
JICE_io.cpp:73: note  in expansion of macro HOST_UDR
   return HOST_UDR
   ^~~~~~~~
sys.h:348: note  suggested alternative  HOST_UCSRA
   #define HOST_UDR XCONCAT(UDR, HOST_USART)
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:348: note  in expansion of macro XCONCAT
   #define HOST_UDR XCONCAT(UDR, HOST_USART)
   ^~~~~~~
JICE_io.cpp:73: note  in expansion of macro HOST_UDR
   return HOST_UDR
   ^~~~~~~~
 
JICE_io.cpp: In function void JICE_io::init()
 
sys.h: 346:32: error: 'UCSRHOST_USARTA' was not declared in this scope
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:346: note  in expansion of macro XCONCAT
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
   ^~~~~~~
JICE_io.cpp:88: note  in expansion of macro HOST_UCSRA
   HOST_UCSRA = (1<<U2X)
   ^~~~~~~~~~
sys.h:346: note  suggested alternative  HOST_UCSRA
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:346: note  in expansion of macro XCONCAT
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
   ^~~~~~~
JICE_io.cpp:88: note  in expansion of macro HOST_UCSRA
   HOST_UCSRA = (1<<U2X)
   ^~~~~~~~~~
 
sys.h: 334:25: error: 'U2XHOST_USART' was not declared in this scope
   #define U2X XCONCAT(U2X, HOST_USART)
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:334: note  in expansion of macro XCONCAT
   #define U2X XCONCAT(U2X, HOST_USART)
   ^~~~~~~
JICE_io.cpp:88: note  in expansion of macro U2X
   HOST_UCSRA = (1<<U2X)
   ^~~
sys.h:334: note  suggested alternative  HOST_UCSRA
   #define U2X XCONCAT(U2X, HOST_USART)
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:334: note  in expansion of macro XCONCAT
   #define U2X XCONCAT(U2X, HOST_USART)
   ^~~~~~~
JICE_io.cpp:88: note  in expansion of macro U2X
   HOST_UCSRA = (1<<U2X)
   ^~~
 
sys.h: 356:33: error: 'UBRRHOST_USARTL' was not declared in this scope
   #define HOST_UBRR XCONCAT(UBRR, XCONCAT(HOST_USART, L))
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:356: note  in expansion of macro XCONCAT
   #define HOST_UBRR XCONCAT(UBRR, XCONCAT(HOST_USART, L))
   ^~~~~~~
JICE_io.cpp:90: note  in expansion of macro HOST_UBRR
   HOST_UBRR = baud_reg_val(19200)
   ^~~~~~~~~
 
sys.h: 347:32: error: 'UCSRHOST_USARTB' was not declared in this scope
   #define HOST_UCSRB XCONCAT(UCSR, XCONCAT(HOST_USART, B))
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:347: note  in expansion of macro XCONCAT
   #define HOST_UCSRB XCONCAT(UCSR, XCONCAT(HOST_USART, B))
   ^~~~~~~
JICE_io.cpp:92: note  in expansion of macro HOST_UCSRB
   HOST_UCSRB = (1<<RXEN)|(1<<TXEN)
   ^~~~~~~~~~
sys.h:347: note  suggested alternative  HOST_UCSRB
   #define HOST_UCSRB XCONCAT(UCSR, XCONCAT(HOST_USART, B))
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:347: note  in expansion of macro XCONCAT
   #define HOST_UCSRB XCONCAT(UCSR, XCONCAT(HOST_USART, B))
   ^~~~~~~
JICE_io.cpp:92: note  in expansion of macro HOST_UCSRB
   HOST_UCSRB = (1<<RXEN)|(1<<TXEN)
   ^~~~~~~~~~
 
sys.h: 336:26: error: 'RXENHOST_USART' was not declared in this scope
   #define RXEN XCONCAT(RXEN, HOST_USART)
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:336: note  in expansion of macro XCONCAT
   #define RXEN XCONCAT(RXEN, HOST_USART)
   ^~~~~~~
JICE_io.cpp:92: note  in expansion of macro RXEN
   HOST_UCSRB = (1<<RXEN)|(1<<TXEN)
   ^~~~
sys.h:336: note  suggested alternative  HOST_UCSRA
   #define RXEN XCONCAT(RXEN, HOST_USART)
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:336: note  in expansion of macro XCONCAT
   #define RXEN XCONCAT(RXEN, HOST_USART)
   ^~~~~~~
JICE_io.cpp:92: note  in expansion of macro RXEN
   HOST_UCSRB = (1<<RXEN)|(1<<TXEN)
   ^~~~
 
sys.h: 335:26: error: 'TXENHOST_USART' was not declared in this scope
   #define TXEN XCONCAT(TXEN, HOST_USART)
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:335: note  in expansion of macro XCONCAT
   #define TXEN XCONCAT(TXEN, HOST_USART)
   ^~~~~~~
JICE_io.cpp:92: note  in expansion of macro TXEN
   HOST_UCSRB = (1<<RXEN)|(1<<TXEN)
   ^~~~
sys.h:335: note  suggested alternative  HOST_UCSRA
   #define TXEN XCONCAT(TXEN, HOST_USART)
sys.h:39: note  in definition of macro CONCAT
   #define CONCAT(A,B) A##B                \\ concatenate
sys.h:335: note  in expansion of macro XCONCAT
   #define TXEN XCONCAT(TXEN, HOST_USART)
   ^~~~~~~
JICE_io.cpp:92: note  in expansion of macro TXEN
   HOST_UCSRB = (1<<RXEN)|(1<<TXEN)
   ^~~~
 
JICE_io.cpp:10: In file included from
 
JICE_io.cpp: In function void JICE_io::flush()
 
sys.h: 346:32: error: 'UCSRHOST_USARTA' was not declared in this scope
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
JICE_io.h:18: note  in definition of macro loop_until_bit_set_or_host_timeout
   checkTimeouts() & WAIT_FOR_HOST)))
   ^~~~~~~~
sys.h:40: note  in expansion of macro CONCAT
   #define XCONCAT(A,B) CONCAT(A,B)        \\ expand and concatenate
   ^~~~~~
sys.h:346: note  in expansion of macro XCONCAT
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))
   ^~~~~~~
JICE_io.cpp:108: note  in expansion of macro HOST_UCSRA
   loop_until_bit_set_or_host_timeout(HOST_UCSRA, TXC)
   ^~~~~~~~~~
sys.h:346: note  suggested alternative  HOST_UCSRA
   #define HOST_UCSRA XCONCAT(UCSR, XCONCAT(HOST_USART, A))

-C option

Hey ElTangas,

I have a request that would make the project more accessible to AVR newbies.

Avrdude allows you to specify a different configuration file path with the -C command. It would be very helpful to add this to the readme, maybe even with an example.

If you want to you could even add a config file to the repo with only the parts you added. This config file can be combined with the systemwide config by adding a + sign in front of the specified path.
Deleting everything that came before the following comment worked for me (and making the changes that I specified in my other issue):
#------------------------------------------------------------
# AVR8X family common values
#------------------------------------------------------------

erasing locked AVR32DA28 - impossible

I am having trouble erasing flash in AVR32DA28. I'm using Arduino UNO as UPDI programmer. Is there any chance to make it work?

I have locked MCU with command:
avrdude -c jtag2updi -p avr32da28 -P COM10 -U lock:w:0xa3:m

Now erasing returns error (also i cannot enter into terminal mode):

d:\jtag2updi-master>avrdude -c jtag2updi -p avr32da28 -P COM10 -u -e -F
avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_read_byte(): bad response to read memory command: RSP_ILLEGAL_MCU_STATE
avr_read(): error reading address 0x0000
    read operation not supported for memory "signature"
avrdude: error reading signature data for part "AVR32DA28", rc=-2
avrdude: error reading signature data, rc=-2
avrdude: jtagmkII_program_disable(): bad response to leave progmode command: RSP_ILLEGAL_MCU_STATE

avrdude done.  Thank you.

Unable to erase ATtiny402

I tried to communicate with the ATtiny402 over UPDI, yet I couldn't. My chips are brand new, I bought them from a very reliable seller. The error message I got after I managed to get the programmer working seemed similar to the message I am supposed to get with a locked chip. I tried to unlock it by erasing it using -e flag or by using -F -t flags, yet none of them worked. I was stuck with the same error message. I am sure that my connections are right, I added a 10uF capacitor on my Arduino Uno to prevent it from resetting (which indeed works), I have copied the .conf file, and all the code I'm using is the most recent one I can get to. I am running everything on a Linux machine. There doesn't seem to be anything about this particular problem in other issues, not open nor closed, as far as I can tell. I'd really appreciate if you could look into this.
The outputs (both verbose and short) of my commands look like this:

$ avrdude -c jtag2updi -P /dev/ttyACM0 -p t402 -F -t

    avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
    avrdude: AVR device initialized and ready to accept instructions

    Reading |                                                    | 0% 0.00savrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
    avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
    avrdude: jtagmkII_read_byte(): bad response to read memory command: RSP_ILLEGAL_MCU_STATE
    avr_read(): error reading address 0x0000
        read operation not supported for memory "signature"
    avrdude: error reading signature data for part "ATtiny402", rc=-2
    avrdude: error reading signature data, rc=-2
    avrdude: jtagmkII_program_disable(): bad response to leave progmode command: RSP_ILLEGAL_MCU_STATE

    avrdude done.  Thank you.`

$ avrdude -c jtag2updi -P /dev/ttyACM0 -p t402 -F -t -v -v -v -v

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

        System wide configuration file is "/etc/avrdude.conf"
        User configuration file is "/home/martin/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : /dev/ttyACM0
        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] . [00] . [06] . [01] . [01] . [00] . [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: < [3c] 
avrdude: Recv: . [7f] 

avrdude: jtagmkII_recv(): Got message seqno 0 (command_sequence == 0)
avrdude: Recv: . [86] . [01] . [01] . [00] . [06] . [01] . [01] . [00] . [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 0x00 0x06 0x01 0x01 0x00 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:              6.00
hardware version:              1
S_MCU:
boot-loader FW version:        1
firmware version:              6.00
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                      : ATtiny402
        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    0      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         32   32      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       4096   64      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        128   32      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] . [00] . [06] . [00] . [06] 
avrdude: Recv: . [ca] 
avrdude: Recv: . [db] 

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

Raw message:
0x81 0x00 0x06 0x00 0x06 
parameter values:
0x00  0x06  0x00  0x06  

        M_MCU hardware version: 1
        M_MCU firmware version: 6.00
        S_MCU hardware version: 1
        S_MCU firmware version: 6.00
        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] @ [40] . [00]   [20] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [10] . [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] @ [40] . [00] . [00] . [00] . [00] . [00] . [00] . [01] . [02] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] ? [3f] W [57] 
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b] 
avrdude: Recv: . [07] 
avrdude: Recv: . [00] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [80] 
avrdude: Recv: | [7c] 
avrdude: Recv: . [9e] 

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

Raw message:
0x80 
OK

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] . [08] . [00] . [02] . [00] . [00] . [00] . [0e] . [0b] . [01] . [de] . [fe] 
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: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude: jtagmkII_read_byte(.., signature, 0x0, ...)
avrdude: jtagmkII_program_enable(): Sending enter progmode command: 
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [09] . [00] . [01] . [00] . [00] . [00] . [0e] . [14] . [dc] | [7c] 
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b] 
avrdude: Recv: . [09] 
avrdude: Recv: . [00] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [a5] 
avrdude: Recv: . [de] 
avrdude: Recv: . [d8] 

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

Raw message:
0xa5 
Illegal MCU state

avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_program_enable(): Sending enter progmode command: 
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0a] . [00] . [01] . [00] . [00] . [00] . [0e] . [14] . [0c] . [f6] 
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b] 
avrdude: Recv: . [0a] 
avrdude: Recv: . [00] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [a5] 
avrdude: Recv: . [0e] 
avrdude: Recv: R [52] 

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

Raw message:
0xa5 
Illegal MCU state

avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_read_byte(): Sending read memory command: 
avrdude: jtagmkII_send(): sending 10 bytes
avrdude: Send: . [1b] . [0b] . [00] . [0a] . [00] . [00] . [00] . [0e] . [05] . [b4] . [01] . [00] . [00] . [00] . [00] . [11] . [00] . [00] . [1a] . [d4] 
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b] 
avrdude: Recv: . [0b] 
avrdude: Recv: . [00] 
avrdude: Recv: . [02] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [a5] . [01] 
avrdude: Recv: 6 [36] 
avrdude: Recv: . [1d] 

avrdude: jtagmkII_recv(): Got message seqno 11 (command_sequence == 11)
avrdude: Recv: . [a5] . [01] 

Raw message:
0xa5 0x01 
Illegal MCU state: Running

avrdude: jtagmkII_read_byte(): bad response to read memory command: RSP_ILLEGAL_MCU_STATE
avr_read(): error reading address 0x0000
    read operation not supported for memory "signature"
avrdude: error reading signature data for part "ATtiny402", rc=-2
avrdude: error reading signature data, rc=-2
avrdude: jtagmkII_program_disable(): Sending leave progmode command: 
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0c] . [00] . [01] . [00] . [00] . [00] . [0e] . [15] 4 [34] . [fa] 
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b] 
avrdude: Recv: . [0c] 
avrdude: Recv: . [00] 
avrdude: Recv: . [02] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [a5] . [00] 
avrdude: Recv: ] [5d] 
avrdude: Recv: . [e5] 

avrdude: jtagmkII_recv(): Got message seqno 12 (command_sequence == 12)
avrdude: Recv: . [a5] . [00] 

Raw message:
0xa5 0x00 
Illegal MCU state: Stopped

avrdude: jtagmkII_program_disable(): bad response to leave progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_close()
avrdude: jtagmkII_close(): Sending GO command: 
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0d] . [00] . [01] . [00] . [00] . [00] . [0e] . [08] . [ef] . [b0] 
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b] 
avrdude: Recv: . [0d] 
avrdude: Recv: . [00] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [80] 
avrdude: Recv: . [af] 
avrdude: Recv: . [b8] 

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

Raw message:
0x80 
OK

avrdude: jtagmkII_close(): Sending sign-off command: 
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0e] . [00] . [01] . [00] . [00] . [00] . [0e] . [00] w [77] . [b6] 
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [00] 
avrdude: Recv: . [01] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [00] 
avrdude: Recv: . [0e] 
avrdude: Recv: . [80] 
avrdude: Recv: . [7f] 
avrdude: Recv: 2 [32] 

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

Raw message:
0x80 
OK


avrdude done.  Thank you.
`

Error programming ATTiny1614: bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE

Recieved the above error and others trying to program several MCUs, all same error, confirmed everyting I can is correct physically and couldn't find anything, full error output below. Using an Arduino Pro mini and standard setup withe resistor on UDPI line.

/home/kais58/.platformio/packages/tool-avrdude-megaavr/avrdude -C /home/kais58/.platformio/packages/tool-avrdude-megaavr/avrdude.conf -c jtag2updi -P /dev/ttyUSB0 -p attiny1614 -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 "/home/kais58/.platformio/packages/tool-avrdude-megaavr/avrdude.conf"
     User configuration file is "/home/kais58/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : /dev/ttyUSB0
     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] . [00] . [06] . [01] . [01] . [00] . [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: < [3c]
avrdude: Recv: . [7f]

avrdude: jtagmkII_recv(): Got message seqno 0 (command_sequence == 0)
avrdude: Recv: . [86] . [01] . [01] . [00] . [06] . [01] . [01] . [00] . [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 0x00 0x06 0x01 0x01 0x00 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: 6.00
hardware version: 1
S_MCU:
boot-loader FW version: 1
firmware version: 6.00
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                      : ATtiny1614
     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         32   32      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      16384   64      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   32      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] . [00] . [06] . [00] . [06]
avrdude: Recv: . [ca]
avrdude: Recv: . [db]

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

Raw message:
0x81 0x00 0x06 0x00 0x06
parameter values:
0x00 0x06 0x00 0x06

     M_MCU hardware version: 1
     M_MCU firmware version: 6.00
     S_MCU hardware version: 1
     S_MCU firmware version: 6.00
     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] @ [40] . [00] [20] . [00] . [00] . [00] . [00] . [00] . [00] . [00] @ [40] . [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] . [01] . [00] . [00] . [00] . [00] . [00] . [01] . [02] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] 5 [35] g [67]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [07]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: | [7c]
avrdude: Recv: . [9e]

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

Raw message:
0x80
OK

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] . [08] . [00] . [02] . [00] . [00] . [00] . [0e] . [0b] . [01] . [de] . [fe]
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: AVR device initialized and ready to accept instructions

Reading | avrdude: jtagmkII_read_byte(.., signature, 0x0, ...)
avrdude: jtagmkII_program_enable(): Sending enter progmode command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [09] . [00] . [01] . [00] . [00] . [00] . [0e] . [14] . [dc] | [7c]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [09]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5]
avrdude: Recv: . [de]
avrdude: Recv: . [d8]

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

Raw message:
0xa5
Illegal MCU state

avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_program_enable(): Sending enter progmode command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0a] . [00] . [01] . [00] . [00] . [00] . [0e] . [14] . [0c] . [f6]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0a]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5]
avrdude: Recv: . [0e]
avrdude: Recv: R [52]

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

Raw message:
0xa5
Illegal MCU state

avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_read_byte(): Sending read memory command:
avrdude: jtagmkII_send(): sending 10 bytes
avrdude: Send: . [1b] . [0b] . [00] . [0a] . [00] . [00] . [00] . [0e] . [05] . [b4] . [01] . [00] . [00] . [00] . [00] . [11] . [00] . [00] . [1a] . [d4]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0b]
avrdude: Recv: . [00]
avrdude: Recv: . [02]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5] . [01]
avrdude: Recv: 6 [36]
avrdude: Recv: . [1d]

avrdude: jtagmkII_recv(): Got message seqno 11 (command_sequence == 11)
avrdude: Recv: . [a5] . [01]

Raw message:
0xa5 0x01
Illegal MCU state: Running

avrdude: jtagmkII_read_byte(): bad response to read memory command: RSP_ILLEGAL_MCU_STATE
avr_read(): error reading address 0x0000
read operation not supported for memory "signature"
avrdude: error reading signature data for part "ATtiny1614", rc=-2
avrdude: error reading signature data, rc=-2
avrdude: jtagmkII_program_disable(): Sending leave progmode command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0c] . [00] . [01] . [00] . [00] . [00] . [0e] . [15] 4 [34] . [fa]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0c]
avrdude: Recv: . [00]
avrdude: Recv: . [02]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5] . [00]
avrdude: Recv: ] [5d]
avrdude: Recv: . [e5]

avrdude: jtagmkII_recv(): Got message seqno 12 (command_sequence == 12)
avrdude: Recv: . [a5] . [00]

Raw message:
0xa5 0x00
Illegal MCU state: Stopped

avrdude: jtagmkII_program_disable(): bad response to leave progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_close()
avrdude: jtagmkII_close(): Sending GO command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0d] . [00] . [01] . [00] . [00] . [00] . [0e] . [08] . [ef] . [b0]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0d]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: . [af]
avrdude: Recv: . [b8]

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

Raw message:
0x80
OK

avrdude: jtagmkII_close(): Sending sign-off command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0e] . [00] . [01] . [00] . [00] . [00] . [0e] . [00] w [77] . [b6]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0e]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: . [7f]
avrdude: Recv: 2 [32]

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

Raw message:
0x80
OK

avrdude done. Thank you.

Does the TEMP register stuff actually save us anything?

It seems hard to believe that this could make that much of a difference...

I didn't see a performance difference using it, thought it made a small difference in the sketch size. Wondering if it's worth even the mess of looking at, since I'm pretty sure the bottle neck isn't shuffling the data to and from the software serial port (and probably actually dealing with said software)

Doesn't work on AVR-DA

The new AVR-DA series (ie AVR128DA48) has a significantly different NVM controller from the Mega0/XTiny chips. (Sigh.) Since flash programming is done by writing the appropriate commands to the NVM controller, you need new code for programming the AVR-DA chips.

Oh! Interesting: the NVMCTRL->CTRLA command used to program mega0 (3: erase and write page) is not documented as even existing on AVR-DA (which has 0,1,2, 8...0x20, 0x30.)

Sigh. I liked the Mega0 implementation :-(

After locking AVR32DA28, unable to communicate via UPDI

After writing the lock fuse to an AVR32DA28 I can no longer do anything over UPDI. Remarkably, the chip still runs its program I flashed prior to locking, so it isn't completely bricked. This issue is repeatable for me, I have done this to two chips now.

I use this command to set the lock:

C:\Users\dalem\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\dalem\Downloads\jtag2updi-master\jtag2updi-master\avrdude.conf -v -v -pavr32da28 -cjtag2updi -PCOM11 -Ulock:w:0x00:m

When I attempt to do anything over UPDI, e.g. attempting to enter interactive mode with -t and -F:

C:\Users\dalem\Downloads\jtag2updi-master\jtag2updi-master>C:\Users\dalem\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\dalem\Downloads\jtag2updi-master\jtag2updi-master\avrdude.conf -pavr32da28 -cjtag2updi -PCOM11 -F -t

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_read_byte(): bad response to read memory command: RSP_ILLEGAL_MCU_STATE
avr_read(): error reading address 0x0000
    read operation not supported for memory "signature"
avrdude: error reading signature data for part "AVR32DA28", rc=-2
avrdude: error reading signature data, rc=-2
avrdude: jtagmkII_program_disable(): bad response to leave progmode command: RSP_ILLEGAL_MCU_STATE

avrdude done.  Thank you.

Verbose output:

C:\Users\dalem\Downloads\jtag2updi-master\jtag2updi-master>C:\Users\dalem\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\dalem\Downloads\jtag2updi-master\jtag2updi-master\avrdude.conf -pavr32da28 -cjtag2updi -PCOM11 -F -t -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\dalem\Downloads\jtag2updi-master\jtag2updi-master\avrdude.conf"

         Using Port                    : COM11
         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] . [00] . [06] . [01] . [01] . [00] . [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: < [3c]
avrdude: Recv: . [7f]

avrdude: jtagmkII_recv(): Got message seqno 0 (command_sequence == 0)
avrdude: Recv: . [86] . [01] . [01] . [00] . [06] . [01] . [01] . [00] . [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 0x00 0x06 0x01 0x01 0x00 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:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  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                      : AVR32DA28
         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        128  128      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    0      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
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           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
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuserow        0     0     0    0 no         16    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          4    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         32   32      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           mmflash        0     0     0    0 no      32768  512      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      32768  512      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        512    1      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] . [00] . [06] . [00] . [06]
avrdude: Recv: . [ca]
avrdude: Recv: . [db]

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

Raw message:
0x81 0x00 0x06 0x00 0x06
parameter values:
0x00  0x06  0x00  0x06

         M_MCU hardware version: 1
         M_MCU firmware version: 6.00
         S_MCU hardware version: 1
         S_MCU firmware version: 6.00
         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] . [00] . [02] . [01] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [80] . [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] @ [40] . [00] . [00] . [00] . [00] . [00] . [00] . [01] . [02] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [ec] . [95]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [07]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: | [7c]
avrdude: Recv: . [9e]

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

Raw message:
0x80
OK

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] . [08] . [00] . [02] . [00] . [00] . [00] . [0e] . [0b] . [01] . [de] . [fe]
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: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude: jtagmkII_read_byte(.., signature, 0x0, ...)
avrdude: jtagmkII_program_enable(): Sending enter progmode command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [09] . [00] . [01] . [00] . [00] . [00] . [0e] . [14] . [dc] | [7c]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [09]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5]
avrdude: Recv: . [de]
avrdude: Recv: . [d8]

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

Raw message:
0xa5
Illegal MCU state

avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_program_enable(): Sending enter progmode command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0a] . [00] . [01] . [00] . [00] . [00] . [0e] . [14] . [0c] . [f6]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0a]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5]
avrdude: Recv: . [0e]
avrdude: Recv: R [52]

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

Raw message:
0xa5
Illegal MCU state

avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_read_byte(): Sending read memory command:
avrdude: jtagmkII_send(): sending 10 bytes
avrdude: Send: . [1b] . [0b] . [00] . [0a] . [00] . [00] . [00] . [0e] . [05] . [b4] . [01] . [00] . [00] . [00] . [00] . [11] . [00] . [00] . [1a] . [d4]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0b]
avrdude: Recv: . [00]
avrdude: Recv: . [02]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5] . [01]
avrdude: Recv: 6 [36]
avrdude: Recv: . [1d]

avrdude: jtagmkII_recv(): Got message seqno 11 (command_sequence == 11)
avrdude: Recv: . [a5] . [01]

Raw message:
0xa5 0x01
Illegal MCU state: Running

avrdude: jtagmkII_read_byte(): bad response to read memory command: RSP_ILLEGAL_MCU_STATE
avr_read(): error reading address 0x0000
    read operation not supported for memory "signature"
avrdude: error reading signature data for part "AVR32DA28", rc=-2
avrdude: error reading signature data, rc=-2
avrdude: jtagmkII_program_disable(): Sending leave progmode command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0c] . [00] . [01] . [00] . [00] . [00] . [0e] . [15] 4 [34] . [fa]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0c]
avrdude: Recv: . [00]
avrdude: Recv: . [02]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5] . [83]
avrdude: Recv: . [ce]
avrdude: Recv: S [53]

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

Raw message:
0xa5 0x83
Illegal MCU state

avrdude: jtagmkII_program_disable(): bad response to leave progmode command: RSP_ILLEGAL_MCU_STATE
avrdude: jtagmkII_close()
avrdude: jtagmkII_close(): Sending GO command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0d] . [00] . [01] . [00] . [00] . [00] . [0e] . [08] . [ef] . [b0]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0d]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: . [af]
avrdude: Recv: . [b8]

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

Raw message:
0x80
OK

avrdude: jtagmkII_close(): Sending sign-off command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0e] . [00] . [01] . [00] . [00] . [00] . [0e] . [00] w [77] . [b6]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0e]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: . [7f]
avrdude: Recv: 2 [32]

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

Raw message:
0x80
OK


avrdude done.  Thank you.

UPDI on ATTiny814

I have tried this with ATTiny412 and ATTiny814, the 412 works well so far and I can re-program the 412 many times, however, I have problems with ATTiny814.

Regarding 814, I can program the chip once then I can not communicate with the chip anymore,
I run this command try to unlock the chip

avrdude -C UDPI.conf -c jtag2updi -PCOM10 -p t814 -t -F
Then....
avrdude: jtagmkII_reset(): bad response to reset command: RSP_ILLEGAL_MCU_STATE
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x656570
avrdude: Expected signature for ATtiny814 is 1E 93 22
avrdude> erase
erase
avrdude: erasing chip
avrdude: jtagmkII_chip_erase(): timeout/error communicating with programmer (status -1)
avrdude>

I always receive the time out communicating with the chip then I can not perform erasing. Is there another way to unlock the chip? Once the chip was programmed, it will be locked even there's no fuse touch?

Thanks.

Using the jtag2updi chip as a serial bridge

Hi!
Would it be possible to use the jtag2updi chip not only work as a programmer, but also a transparent serial bridge between the USB to serial chip and the target? Preferable also automatic switching, so that we don't need to attach a jumper or something to switch between the two options.

I'm planning to make a development board for the ATmega809/1609/3209/4809 family, and it would be awesome if I could upload new programs and use the serial monitor with the same onboard USB connector.

                                          V_prog                 V_target
                                              +-+                     +-+
                                               |                       |
 +----------+          +---------------------+ |                       | +--------------------+
 | PC       |          | Programmer          +-+                       +-+  Target            |
 | avrdude  |          |                     |      +----------+         |                    |
 |       TX +----------+ RX              PD6 +------+   4k7    +---------+ UPDI               |
 |          |          |                     |      +----------+         |                    |
 |       RX +----------+ TX               TX +---------------------------+ RX                 |
 |          |          |                     |                           |                    |
 |          |          |                  RX +---------------------------+ TX                 |
 |          |          |                     |                           |                    |
 |          |          |                     +--+                     +--+                    |
 +----------+          +---------------------+  |                     |  +--------------------+
             JTAGICE MkII                      +-+     UPDI          +-+
             Protocol                          GND     Protocol      GND

avrdude.conf is broken

Hello,

your current avrdude.conf is broken. The previous one without ATmega-DA support works with my ATmega4808.

For example.
avrdude -c jtag2updi -P com9 -p m4808 -v

avrdude: error at C:\avrToolchain\avrdude\avrdude.conf:1115: programmer type jtagice3_updi not found
avrdude: error reading system wide configuration file "C:\avrToolchain\avrdude\avrdude.conf"

Something's not right. :-)

Feature request: series 2 support

Hi ElTangas,

thanks for your awesome work so far! Does jtag2updi also support flashing of Attiny series 2, like the ATTINY1626?

Thanks & Greetings from Germany,
Timm

Embedding inside an Arduino Project

This is more of a usage question: is it possible to embed this code inside an existing Arduino Project and still retain the ability to flash a TinyAVR MCU?

Is jtag strictly necessary for the process to work or could you also transmit the data using a custom Serial Protocol?

Can't unlock ATTiny1624

Well, I have no idea where else to go. I bought a brand new ATTiny from Mouser and it seemed to come locked. So I tried to unlock it by erasing it (-e or -e -F), which just gave me the error here:

avrdude.exe: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude.exe: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude.exe: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude.exe: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE
avrdude.exe: jtagmkII_read_byte(): bad response to read memory command: RSP_ILLEGAL_MCU_STATE
avr_read(): error reading address 0x0000
    read operation not supported for memory "signature"
avrdude.exe: error reading signature data for part "ATtiny1624", rc=-2
avrdude.exe: error reading signature data, rc=-2
avrdude.exe: jtagmkII_program_disable(): bad response to leave progmode command: RSP_ILLEGAL_MCU_STATE

avrdude.exe done.  Thank you.

I then tried to use the interactive terminal. So I uncommented the #define DISABLE_HOST_TIMEOUT and #define DISABLE_TARGET_TIMEOUT (tried it with and without the second define). I was then able to get into the terminal. But when I tried to erase the chip from here, I just got another error:

avrdude.exe: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude.exe: jtagmkII_reset(): bad response to reset command: RSP_ILLEGAL_MCU_STATE
avrdude.exe: initialization failed, rc=-1
avrdude.exe: AVR device initialized and ready to accept instructions
avrdude.exe: Device signature = 0x666c61
avrdude.exe: Expected signature for ATtiny1624 is 1E 94 2A
avrdude> erase
>>> erase
avrdude.exe: erasing chip
avrdude.exe: jtagmkII_chip_erase(): timeout/error communicating with programmer (status -1)
avrdude> quit
>>> quit
avrdude.exe: jtagmkII_close(): timeout/error communicating with programmer (status -1)
avrdude.exe: jtagmkII_close(): timeout/error communicating with programmer (status -1)

avrdude.exe done.  Thank you.

Looks to be the same error as here #24, which makes me guess, that my ATTiny is broken.

So, is my ATTiny actually broken or is there anything I can try? Thanks in advance for any help



Here is the verbose log when using -e only:

avrdude.exe: 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 "C:\Users\Stratos\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.5.11/avrdude.conf"

             Using Port                    : COM7
             Using Programmer              : jtag2updi
             Overriding Baud Rate          : 115200
avrdude.exe: jtagmkII_open_pdi()
avrdude.exe: jtagmkII_getsync()
avrdude.exe: jtagmkII_getsync(): Sending sign-on command:
avrdude.exe: jtagmkII_send(): sending 1 bytes
avrdude.exe: Send: . [1b] . [00] . [00] . [01] . [00] . [00] . [00] . [0e] . [01] . [f3] . [97]
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [1d]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [0e]
avrdude.exe: Recv: . [86] . [01] . [01] . [00] . [06] . [01] . [01] . [00] . [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.exe: Recv: < [3c]
avrdude.exe: Recv: . [7f]

avrdude.exe: jtagmkII_recv(): Got message seqno 0 (command_sequence == 0)

Raw message:
0x86 0x01 0x01 0x00 0x06 0x01 0x01 0x00 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:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
avrdude.exe: jtagmkII_getsync(): Using a 298-byte device descriptor
avrdude.exe: jtagmkII_setparm()
avrdude.exe: jtagmkII_setparm(): Sending set parameter command (parm 0x03, 1 bytes):
avrdude.exe: jtagmkII_send(): sending 3 bytes
avrdude.exe: Send: . [1b] . [01] . [00] . [03] . [00] . [00] . [00] . [0e] . [02] . [03] . [06] $ [24] 1 [31]
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b]
avrdude.exe: Recv: . [01]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [01]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [0e]
avrdude.exe: Recv: . [80]
avrdude.exe: Recv: . [cd]
avrdude.exe: Recv: . [83]

avrdude.exe: jtagmkII_recv(): Got message seqno 1 (command_sequence == 1)

Raw message:
0x80
OK

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

avrdude.exe: jtagmkII_recv(): Got message seqno 2 (command_sequence == 2)

Raw message:
0x80
OK

             AVR Part                      : ATtiny1624
             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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      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
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               usersig        0     0     0    0 no         32   32      0     0     0 0x00 0x00
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               flash          0     0     0    0 no      16384   64      0     0     0 0x00 0x00
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom         0     0     0    0 no        256   32      0     0     0 0x00 0x00
                 Memory Ops:
                   Oeration     Inst Bit  Bit Type  Bitno  Value
                   -----------  --------  --------  -----  -----

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

avrdude.exe: jtagmkII_recv(): Got message seqno 3 (command_sequence == 3)

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

avrdude.exe: jtagmkII_getparm()
avrdude.exe: jtagmkII_getparm(): Sending get parameter command (parm 0x02):
avrdude.exe: jtagmkII_send(): sending 2 bytes
avrdude.exe: Send: . [1b] . [04] . [00] . [02] . [00] . [00] . [00] . [0e] . [03] . [02] . [aa] B [42]
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b]
avrdude.exe: Recv: . [04]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [05]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [0e]
avrdude.exe: Recv: . [81] . [00] . [06] . [00] . [06]
avrdude.exe: Recv: . [ca]
avrdude.exe: Recv: . [db]

avrdude.exe: jtagmkII_recv(): Got message seqno 4 (command_sequence == 4)

Raw message:
0x81 0x00 0x06 0x00 0x06
parameter values:
0x00  0x06  0x00  0x06

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

avrdude.exe: jtagmkII_recv(): Got message seqno 5 (command_sequence == 5)

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

             Vtarget         : 5.0 V

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

avrdude.exe: jtagmkII_recv(): Got message seqno 6 (command_sequence == 6)

Raw message:
0x80
OK

avrdude.exe: jtagmkII_set_devdescr(): Sending set device descriptor command:
avrdude.exe: jtagmkII_send(): sending 299 bytes
avrdude.exe: 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] @ [40] . [00]   [20] . [00] . [00] . [00] . [00] . [00] . [00] . [00] @ [40] . [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] . [01] . [00] . [00] . [00] . [00] . [00] . [01] . [02] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] 5 [35] g [67]
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b]
avrdude.exe: Recv: . [07]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [01]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [0e]
avrdude.exe: Recv: . [80]
avrdude.exe: Recv: | [7c]
avrdude.exe: Recv: . [9e]

avrdude.exe: jtagmkII_recv(): Got message seqno 7 (command_sequence == 7)

Raw message:
0x80
OK

avrdude.exe: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude.exe: jtagmkII_reset(): Sending reset command:
avrdude.exe: jtagmkII_send(): sending 2 bytes
avrdude.exe: Send: . [1b] . [08] . [00] . [02] . [00] . [00] . [00] . [0e] . [0b] . [01] . [de] . [fe]
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b]
avrdude.exe: Recv: . [08]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [02]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [0e]
avrdude.exe: Recv: . [a5] . [00]
avrdude.exe: Recv: . [b8]
avrdude.exe: Recv: . [da]

avrdude.exe: jtagmkII_recv(): Got message seqno 8 (command_sequence == 8)

Raw message:
0xa5 0x00
Illegal MCU state: Stopped

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

avrdude.exe: jtagmkII_close()
avrdude.exe: jtagmkII_close(): Sending GO command:
avrdude.exe: jtagmkII_send(): sending 1 bytes
avrdude.exe: Send: . [1b] . [09] . [00] . [01] . [00] . [00] . [00] . [0e] . [08] 1 [31] . [a6]
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b]
avrdude.exe: Recv: . [09]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [01]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [0e]
avrdude.exe: Recv: . [80]
avrdude.exe: Recv: q [71]
avrdude.exe: Recv: . [ae]

avrdude.exe: jtagmkII_recv(): Got message seqno 9 (command_sequence == 9)

Raw message:
0x80
OK

avrdude.exe: jtagmkII_close(): Sending sign-off command:
avrdude.exe: jtagmkII_send(): sending 1 bytes
avrdude.exe: Send: . [1b] . [0a] . [00] . [01] . [00] . [00] . [00] . [0e] . [00] . [a9] . [a0]
avrdude.exe: jtagmkII_recv():
avrdude.exe: Recv: . [1b]
avrdude.exe: Recv: . [0a]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [01]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [00]
avrdude.exe: Recv: . [0e]
avrdude.exe: Recv: . [80]
avrdude.exe: Recv: . [a1]
avrdude.exe: Recv: $ [24]

avrdude.exe: jtagmkII_recv(): Got message seqno 10 (command_sequence == 10)

Raw message:
0x80
OK


avrdude.exe done.  Thank you.

erase not working after lockbit set

Chip: Attiny 404

  1. I programmed my device with the following .......avrdude.conf -v -pattiny404 -cjtag2updi -PCOM1 -Ufuse2:w:0x02:m -Ufuse6:w:0x04:m -Ufuse8:w:0x00:m -Ulock:w:0x5C:m -Uflash:w:C:\Users.......
  2. I confirmed device is locked
  3. I attempted to erase, but I can't seem to get it to erase

`C:\Users\m\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -C C:\Users\m\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.2.9/avrdude.conf -v -p t404 -c jtag2updi -P COM1 -e

avrdude.exe: 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\m\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.2.9/avrdude.conf"

         Using Port                    : COM1
         Using Programmer              : jtag2updi

JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
boot-loader FW version: 1
firmware version: 6.00
hardware version: 1
S_MCU:
boot-loader FW version: 1
firmware version: 6.00
hardware version: 1
Serial number: 00:00:00:00:00:00
Device ID: JTAGICE mkII
AVR Part : ATtiny404
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
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
           fuses          0     0     0    0 no          9   10      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8          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
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           usersig        0     0     0    0 no         32   32      0     0     0 0x00 0x00
           flash          0     0     0    0 no       4096   64      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no        128   32      0     0     0 0x00 0x00

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
         M_MCU hardware version: 1
         M_MCU firmware version: 6.00
         S_MCU hardware version: 1
         S_MCU firmware version: 6.00
         Serial number:          00:00:00:00:00:00
         Vtarget         : 5.0 V

avrdude.exe: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude.exe: jtagmkII_reset(): timeout/error communicating with programmer (status -1)
avrdude.exe: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude.exe: jtagmkII_close(): timeout/error communicating with programmer (status -1)
avrdude.exe: jtagmkII_close(): timeout/error communicating with programmer (status -1)

avrdude.exe done. Thank you.`

Can't unlock a locked ATtiny404 with chip erase - "avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ ILLEGAL_MCU_STATE"

Hi ElTangas,

Firstly, thanks for providing the library, it's great!

I'm just having this one issue when trying to unlock some ATtiny404s running at 1MHz clock using an Arduino Nano for the jtag2updi link. I've tried on a few chips now so I'm reasonably confident it's not hardware issues with the chips and is probably something I've overlooked. I compiled avrdude.conf for these at 1MHz and have been using it to flash hex files and lock them successfully.

I'm locking them with:
avrdude -c jtag2updi -P com7 -p attiny404 -u -U lock:w:0xC4:m
And trying to unlock with:
avrdude -c jtag2updi -P com7 -p attiny404 -u -e
Although I have tried a few other options and lock bit patterns.

Do you have any advice or thoughts on what is going on?

I've included the verbose output below:

"I:\Clients\066-UNITED BEV\066-03 HANDS FREE\Manufacturing\1D\01-software>"C:\Pro
gram Files (x86)\Arduino\hardware\tools\avr\bin\avrdude" -c jtag2updi -P com7 -p
 attiny404 -u -e -vvvv

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 "I:\Clients\066-UNITED BEV\066-03 HAN
DS FREE\Manufacturing\1D\01-software\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] . [00] . [06] . [01] . [01] . [00] . [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: < [3c]
avrdude: Recv: . [7f]

avrdude: jtagmkII_recv(): Got message seqno 0 (command_sequence == 0)
avrdude: Recv: . [86] . [01] . [01] . [00] . [06] . [01] . [01] . [00] . [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 0x00 0x06 0x01 0x01 0x00 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:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  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                      : ATtiny404
         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  Max
W   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  Max
W   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  Max
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
           fuses          0     0     0    0 no          9    0      0     0
 0 0x00 0x00
                                  Block Poll               Page
      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  Max
W   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  Max
W   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  Max
W   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  Max
W   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  Max
W   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  Max
W   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  Max
W   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  Max
W   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  Max
W   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  Max
W   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  Max
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
           usersig        0     0     0    0 no         32   32      0     0
 0 0x00 0x00
                                  Block Poll               Page
      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  Max
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
           flash          0     0     0    0 no       4096   64      0     0
 0 0x00 0x00
                                  Block Poll               Page
      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  Max
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
           eeprom         0     0     0    0 no        128   32      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] . [00] . [06] . [00] . [06]
avrdude: Recv: . [ca]
avrdude: Recv: . [db]

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

Raw message:
0x81 0x00 0x06 0x00 0x06
parameter values:
0x00  0x06  0x00  0x06

         M_MCU hardware version: 1
         M_MCU firmware version: 6.00
         S_MCU hardware version: 1
         S_MCU firmware version: 6.00
         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] . [0
0] . [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] . [0
0] . [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] . [0
0] . [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] @ [40] . [00]   [20] . [00] . [00] . [00] . [00] . [00] . [00
] . [00] . [10] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] .
 [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [0
0] . [00] . [00] . [00] . [00] . [00] . [00] @ [40] . [00] . [00] . [00] . [00]
. [00] . [00] . [01] . [02] . [00] . [00] . [00] . [00] . [00] . [00] . [00] . [
00] ? [3f] W [57]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [07]
avrdude: Recv: . [00]
avrdude: Recv: . [18]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80] S [53] I [49] B [42] t [74] i [69] n [6e] y [79] A [41] V
[56] R [52]   [20] P [50] : [3a] 0 [30] D [44] : [3a] 0 [30] - [2d] 3 [33] N [4e
] V [56] M [4d] 1 [31]
avrdude: Recv: . [87]
avrdude: Recv: ^ [5e]

avrdude: jtagmkII_recv(): Got message seqno 7 (command_sequence == 7)
avrdude: Recv: . [80] S [53] I [49] B [42] t [74] i [69] n [6e] y [79] A [41] V
[56] R [52]   [20] P [50] : [3a] 0 [30] D [44] : [3a] 0 [30] - [2d] 3 [33] N [4e
] V [56] M [4d] 1 [31]

Raw message:
0x80 0x53 0x49 0x42 0x74 0x69 0x6e 0x79 0x41 0x56 0x52 0x20 0x50 0x3a 0x30 0x44
0x3a 0x30 0x2d 0x33 0x4e 0x56 0x4d 0x31
OK

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in des
cription
avrdude: jtagmkII_reset(): Sending reset command:
avrdude: jtagmkII_send(): sending 2 bytes
avrdude: Send: . [1b] . [08] . [00] . [02] . [00] . [00] . [00] . [0e] . [0b] .
[01] . [de] . [fe]
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: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00savrdude:
jtagmkII_read_byte(.., signature, 0x0, ...)
avrdude: jtagmkII_program_enable(): Sending enter progmode command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [09] . [00] . [01] . [00] . [00] . [00] . [0e] . [14] .
[dc] | [7c]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [09]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5]
avrdude: Recv: . [de]
avrdude: Recv: . [d8]

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

Raw message:
0xa5
Illegal MCU state

avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_
ILLEGAL_MCU_STATE
avrdude: jtagmkII_program_enable(): Sending enter progmode command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0a] . [00] . [01] . [00] . [00] . [00] . [0e] . [14] .
[0c] . [f6]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0a]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5]
avrdude: Recv: . [0e]
avrdude: Recv: R [52]

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

Raw message:
0xa5
Illegal MCU state

avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_
ILLEGAL_MCU_STATE
avrdude: jtagmkII_read_byte(): Sending read memory command:
avrdude: jtagmkII_send(): sending 10 bytes
avrdude: Send: . [1b] . [0b] . [00] . [0a] . [00] . [00] . [00] . [0e] . [05] .
[b4] . [01] . [00] . [00] . [00] . [00] . [11] . [00] . [00] . [1a] . [d4]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0b]
avrdude: Recv: . [00]
avrdude: Recv: . [02]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5] . [01]
avrdude: Recv: 6 [36]
avrdude: Recv: . [1d]

avrdude: jtagmkII_recv(): Got message seqno 11 (command_sequence == 11)
avrdude: Recv: . [a5] . [01]

Raw message:
0xa5 0x01
Illegal MCU state: Running

avrdude: jtagmkII_read_byte(): bad response to read memory command: RSP_ILLEGAL_
MCU_STATE
avr_read(): error reading address 0x0000
    read operation not supported for memory "signature"
avrdude: error reading signature data for part "ATtiny404", rc=-2
avrdude: error reading signature data, rc=-2
avrdude: jtagmkII_program_disable(): Sending leave progmode command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0c] . [00] . [01] . [00] . [00] . [00] . [0e] . [15] 4
[34] . [fa]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0c]
avrdude: Recv: . [00]
avrdude: Recv: . [02]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [a5] . [83]
avrdude: Recv: . [ce]
avrdude: Recv: S [53]

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

Raw message:
0xa5 0x83
Illegal MCU state

avrdude: jtagmkII_program_disable(): bad response to leave progmode command: RSP
_ILLEGAL_MCU_STATE
avrdude: jtagmkII_close()
avrdude: jtagmkII_close(): Sending GO command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0d] . [00] . [01] . [00] . [00] . [00] . [0e] . [08] .
[ef] . [b0]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0d]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: . [af]
avrdude: Recv: . [b8]

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

Raw message:
0x80
OK

avrdude: jtagmkII_close(): Sending sign-off command:
avrdude: jtagmkII_send(): sending 1 bytes
avrdude: Send: . [1b] . [0e] . [00] . [01] . [00] . [00] . [00] . [0e] . [00] w
[77] . [b6]
avrdude: jtagmkII_recv():
avrdude: Recv: . [1b]
avrdude: Recv: . [0e]
avrdude: Recv: . [00]
avrdude: Recv: . [01]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [00]
avrdude: Recv: . [0e]
avrdude: Recv: . [80]
avrdude: Recv: . [7f]
avrdude: Recv: 2 [32]

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

Raw message:
0x80
OK


avrdude done.  Thank you.

`

Arduino uno progrramer error

I want to make programmer arudiono uno but I have this error:

Arduino: 1.8.19 (Linux), Board: "ATtiny1614/1604/814/804/414/404 w/Optiboot, ATtiny414, 20 MHz internal, Enabled (default timer), 1.8V (5 MHz or less), Disabled/Disabled, TX:5 (PB2), RX:4 (PB3), UPDI, Optiboot for 8 sec. after power-on & reset, 8ms, Master or Slave (saves flash and RAM), Default (doesn't print floats, 1.4k flash use), On all pins, like usual"











In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:10:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:326:4: warning: #warning "Part not supported - if you didn't provide all the needed pin definitions, that's why it's not compiling" [-Wcpp]
   #warning "Part not supported - if you didn't provide all the needed pin definitions, that's why it's not compiling"
    ^~~~~~~
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:10:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:326:4: warning: #warning "Part not supported - if you didn't provide all the needed pin definitions, that's why it's not compiling" [-Wcpp]
   #warning "Part not supported - if you didn't provide all the needed pin definitions, that's why it's not compiling"
    ^~~~~~~
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JTAG2.h:12:0,
                 from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.h:13,
                 from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:10:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:326:4: warning: #warning "Part not supported - if you didn't provide all the needed pin definitions, that's why it's not compiling" [-Wcpp]
   #warning "Part not supported - if you didn't provide all the needed pin definitions, that's why it's not compiling"
    ^~~~~~~
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:11:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/dbg.h:232:4: warning: #warning "Part not supported - if you didn't provide all the needed pin definitions, that's why it's not compiling" [-Wcpp]
   #warning "Part not supported - if you didn't provide all the needed pin definitions, that's why it's not compiling"
    ^~~~~~~
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:12:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/dbg.h:232:4: warning: #warning "Part not supported - if you didn't provide all the needed pin definitions, that's why it's not compiling" [-Wcpp]
   #warning "Part not supported - if you didn't provide all the needed pin definitions, that's why it's not compiling"
    ^~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp: In function 'uint8_t UPDI_io::get()':
sys.h:48:26: error: 'VPORTUPDI_PORT' was not declared in this scope
   # define DDR(x) CONCAT(VPORT,x).DIR
                          ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:54:9: note: in expansion of macro 'DDR'
         DDR(UPDI_PORT)  &= ~(1 << UPDI_PIN);
         ^~~
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:10:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp: In function 'void SYS::init()':
sys.h:48:26: error: 'VPORTLED_PORT' was not declared in this scope
   # define DDR(x) CONCAT(VPORT,x).DIR
                          ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:42:3: note: in expansion of macro 'DDR'
   DDR(LED_PORT) |= (1 << LED_PIN);
   ^~~
In file included from /home/muhammetubuntu/.arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino4b/avr/include/avr/io.h:99:0,
                 from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:9:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp: In function 'uint8_t JICE_io::put(char)':
JICE_io.cpp:55:25: error: 'HOST_USART' was not declared in this scope
   loop_until_bit_is_set(HOST_USART.STATUS, USART_DREIF_bp);
                         ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:48:26: note: suggested alternative: 'VPORTA_OUT'
   # define DDR(x) CONCAT(VPORT,x).DIR
                          ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:42:3: note: in expansion of macro 'DDR'
   DDR(LED_PORT) |= (1 << LED_PIN);
   ^~~
sys.cpp:42:26: error: 'LED_PIN' was not declared in this scope
   DDR(LED_PORT) |= (1 << LED_PIN);
                          ^~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:48:26: note: suggested alternative: 'VPORTA_OUT'
   # define DDR(x) CONCAT(VPORT,x).DIR
                          ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:54:9: note: in expansion of macro 'DDR'
         DDR(UPDI_PORT)  &= ~(1 << UPDI_PIN);
         ^~~
updi_io_soft.cpp:54:35: error: 'UPDI_PIN' was not declared in this scope
         DDR(UPDI_PORT)  &= ~(1 << UPDI_PIN);
                                   ^~~~~~~~
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:10:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp: In function 'void SYS::setLED()':
sys.h:47:27: error: 'VPORTLED_PORT' was not declared in this scope
   # define PORT(x) CONCAT(VPORT,x).OUT
                           ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:58:3: note: in expansion of macro 'PORT'
   PORT(LED_PORT) |= 1 << LED_PIN;
   ^~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:54:35: note: suggested alternative: 'UPDI_BAUD'
         DDR(UPDI_PORT)  &= ~(1 << UPDI_PIN);
                                   ^~~~~~~~
                                   UPDI_BAUD
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:55:25: note: suggested alternative: 'IO_START'
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:10:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp: In function 'uint8_t JICE_io::get()':
JICE_io.cpp:67:38: error: 'HOST_USART' was not declared in this scope
   loop_until_bit_set_or_host_timeout(HOST_USART.STATUS, USART_RXCIF_bp); /* Wait until data exists. */
                                      ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.h:18:12: note: in definition of macro 'loop_until_bit_set_or_host_timeout'
   while(!((register&(1<<bitpos))||(SYS::checkTimeouts() & WAIT_FOR_HOST))); \
            ^~~~~~~~
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:10:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp: In function 'uint8_t UPDI_io::put(char)':
sys.h:48:26: error: 'VPORTUPDI_PORT' was not declared in this scope
   # define DDR(x) CONCAT(VPORT,x).DIR
                          ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:175:9: note: in expansion of macro 'DDR'
         DDR(UPDI_PORT) |= (1 << UPDI_PIN);
         ^~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:67:38: note: suggested alternative: 'IO_START'
   loop_until_bit_set_or_host_timeout(HOST_USART.STATUS, USART_RXCIF_bp); /* Wait until data exists. */
                                      ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.h:18:12: note: in definition of macro 'loop_until_bit_set_or_host_timeout'
   while(!((register&(1<<bitpos))||(SYS::checkTimeouts() & WAIT_FOR_HOST))); \
            ^~~~~~~~
JICE_io.cpp:69:10: error: 'HOST_USART' was not declared in this scope
   return HOST_USART.RXDATAL;
          ^~~~~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:47:27: note: suggested alternative: 'VPORTA_OUT'
   # define PORT(x) CONCAT(VPORT,x).OUT
                           ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:58:3: note: in expansion of macro 'PORT'
   PORT(LED_PORT) |= 1 << LED_PIN;
   ^~~~
sys.cpp:58:26: error: 'LED_PIN' was not declared in this scope
   PORT(LED_PORT) |= 1 << LED_PIN;
                          ^~~~~~~
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:10:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp: In function 'void SYS::clearLED()':
sys.h:47:27: error: 'VPORTLED_PORT' was not declared in this scope
   # define PORT(x) CONCAT(VPORT,x).OUT
                           ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:62:3: note: in expansion of macro 'PORT'
   PORT(LED_PORT) &= ~(1 << LED_PIN);
   ^~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:69:10: note: suggested alternative: 'IO_START'
   return HOST_USART.RXDATAL;
          ^~~~~~~~~~
          IO_START
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JTAG2.h:12:0,
                 from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.h:13,
                 from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:10:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp: In function 'void JICE_io::init()':
sys.h:47:27: error: 'VPORTHOST_TX_PORT' was not declared in this scope
   # define PORT(x) CONCAT(VPORT,x).OUT
                           ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:80:3: note: in expansion of macro 'PORT'
   PORT(HOST_TX_PORT) |= 1 << HOST_TX_PIN;
   ^~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:48:26: note: suggested alternative: 'VPORTA_OUT'
   # define DDR(x) CONCAT(VPORT,x).DIR
                          ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:175:9: note: in expansion of macro 'DDR'
         DDR(UPDI_PORT) |= (1 << UPDI_PIN);
         ^~~
updi_io_soft.cpp:175:33: error: 'UPDI_PIN' was not declared in this scope
         DDR(UPDI_PORT) |= (1 << UPDI_PIN);
                                 ^~~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:47:27: note: suggested alternative: 'VPORTA_OUT'
   # define PORT(x) CONCAT(VPORT,x).OUT
                           ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.cpp:62:3: note: in expansion of macro 'PORT'
   PORT(LED_PORT) &= ~(1 << LED_PIN);
   ^~~~
sys.cpp:62:28: error: 'LED_PIN' was not declared in this scope
   PORT(LED_PORT) &= ~(1 << LED_PIN);
                            ^~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:175:33: note: suggested alternative: 'UPDI_BAUD'
         DDR(UPDI_PORT) |= (1 << UPDI_PIN);
                                 ^~~~~~~~
                                 UPDI_BAUD
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:10:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp: In function 'void send_break()':
sys.h:48:26: error: 'VPORTUPDI_PORT' was not declared in this scope
   # define DDR(x) CONCAT(VPORT,x).DIR
                          ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:236:9: note: in expansion of macro 'DDR'
         DDR(UPDI_PORT) |= (1 << UPDI_PIN);
         ^~~
JICE_io.cpp:80:30: error: 'HOST_TX_PIN' was not declared in this scope
   PORT(HOST_TX_PORT) |= 1 << HOST_TX_PIN;
                              ^~~~~~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:48:26: note: suggested alternative: 'VPORTA_OUT'
   # define DDR(x) CONCAT(VPORT,x).DIR
                          ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/sys.h:39:21: note: in definition of macro 'CONCAT'
 #define CONCAT(A,B) A##B                // concatenate
                     ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:236:9: note: in expansion of macro 'DDR'
         DDR(UPDI_PORT) |= (1 << UPDI_PIN);
         ^~~
updi_io_soft.cpp:236:33: error: 'UPDI_PIN' was not declared in this scope
         DDR(UPDI_PORT) |= (1 << UPDI_PIN);
                                 ^~~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/updi_io_soft.cpp:236:33: note: suggested alternative: 'UPDI_BAUD'
         DDR(UPDI_PORT) |= (1 << UPDI_PIN);
                                 ^~~~~~~~
                                 UPDI_BAUD
JICE_io.cpp:83:3: error: 'HOST_USART' was not declared in this scope
   HOST_USART.BAUD = baud_reg_val(19200);
   ^~~~~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:83:3: note: suggested alternative: 'IO_START'
   HOST_USART.BAUD = baud_reg_val(19200);
   ^~~~~~~~~~
   IO_START
In file included from /home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:10:0:
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp: In function 'void JICE_io::flush()':
JICE_io.cpp:106:38: error: 'HOST_USART' was not declared in this scope
   loop_until_bit_set_or_host_timeout(HOST_USART.STATUS, USART_TXCIF_bp);
                                      ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.h:18:12: note: in definition of macro 'loop_until_bit_set_or_host_timeout'
   while(!((register&(1<<bitpos))||(SYS::checkTimeouts() & WAIT_FOR_HOST))); \
            ^~~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:106:38: note: suggested alternative: 'IO_START'
   loop_until_bit_set_or_host_timeout(HOST_USART.STATUS, USART_TXCIF_bp);
                                      ^
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.h:18:12: note: in definition of macro 'loop_until_bit_set_or_host_timeout'
   while(!((register&(1<<bitpos))||(SYS::checkTimeouts() & WAIT_FOR_HOST))); \
            ^~~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp: In function 'void JICE_io::set_baud(JTAG2::baud_rate)':
JICE_io.cpp:114:3: error: 'HOST_USART' was not declared in this scope
   HOST_USART.BAUD = baud_tbl[rate - 1];
   ^~~~~~~~~~
/home/muhammetubuntu/Codes/jtag2updi/source/jtag2updi/JICE_io.cpp:114:3: note: suggested alternative: 'IO_START'
   HOST_USART.BAUD = baud_tbl[rate - 1];
   ^~~~~~~~~~
   IO_START
exit status 1
'VPORTUPDI_PORT' was not declared in this scope


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Help please!

Arduino Mega 2560 connection

Hi !

I tried to use my Arduino Mega board (one of the firsts rev. I think) and I'm having issues :

I compiled thru Arduino project and uploaded the code, I think this part is fine as the board's led is slightly lit (probably waiting for a usb<->serial signal).

My setup is the following :

Attiny402 -> PA0(UPDI pin) -> 4K9 resistor (close enough) -> Arduino Mega board header PWM pin 6

The Arduino's auto-reset is disabled via a 100uF capacitor across reset and GND.
Attiny's Vdd and GND are connected to 5v and GND on the Arduino Mega board supply should be ok).

I installed avrdude, and using this command in jtag2updi folder (the port can seem wrong, but it's the right one using MacOS) :

avrdude -C avrdude.conf -c jtag2updi -P /dev/cu.usbmodem143411 -p t402

... I've got either of these two logs :

avrdude: jtagmkII_reset(): timeout/error communicating with programmer (status -1)
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: jtagmkII_close(): timeout/error communicating with programmer (status -1)
avrdude: jtagmkII_close(): timeout/error communicating with programmer (status -1)

avrdude done.  Thank you.

... or ...

avrdude: jtagmkII_getsync(): sign-on command: status -1

... in loop so I have to kill it (by Ctrl-C).

Maybe the pin I connect the UPDI pin is the wrong one ?

Thanks for taking care and for this awesome project,

Cheers !

Why PD6?

When using a programmer made from ARDUINO UNO, NANO and possibly LEONARDO it would be convenient to use the connector originally designed for ICSP. For this case it would be necessary to use one of the terminals MISO, MOSI, SCK instead of PD6. What conditions would have to be met?
Will the modification of the https://github.com/ElTangas/jtag2updi/blob/master/source/sys.h file meet all requirements?

jtag2updi broken with avrdude-7.0

Just a quick heads-up that jtag2updi stopped working for me after upgrading to avrdude-7.0.

The failure mode is as follows:

% avrdude -p t824 -c jtag2updi -P /dev/ttyUSB2 -C avrdude.conf

Error: programmer jtag2updi does not support target ATtiny824

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

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

avrdude done.  Thank you.

avrdude.conf is the latest version from the jtag2updi master branch.

Here's the output with -v:

% avrdude -p t824 -c jtag2updi -P /dev/ttyUSB2 -C avrdude.conf -v

avrdude: Version 7.0
         Copyright (c) Brian Dean, http://www.bdmicro.com/
         Copyright (c) Joerg Wunsch

         System wide configuration file is "avrdude.conf"
         User configuration file is "/home/mhx/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB2
         Using Programmer              : jtag2updi
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.00
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
         AVR Part                      : ATtiny824
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         Serial program mode           : yes
         Parallel program mode         : yes
         Memory Detail                 :

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

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
         M_MCU HW version: 1
         M_MCU FW version: 6.00
         S_MCU HW version: 1
         S_MCU FW version: 6.00
         Serial number   : 00:00:00:00:00:00
         Vtarget         : 5.0 V

Error: programmer jtag2updi does not support target ATtiny824

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

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

avrdude done.  Thank you.

Downgrading to avrdude-6.3 makes things work again:

% avrdude -p t824 -c jtag2updi -P /dev/ttyUSB2 -C avrdude.conf   

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x1e9329 (probably t824)

avrdude done.  Thank you.

I'm happy to do more tests / provide more information if necessary.

Suppressing avrdude harmless warning on "Cannot locate “flash” and “boot” memories in description"

Hi,

Thank you very much for writing this program as it has allowed both official Arduinos (e.g. Nano Every) and other AVRs to be able to take advantage of UPDI in a cost effective manner.

I am currently developing an educational microcontroller board (ATmega4809 based) that utilises jtag2updi for the programming interface and noticed that a spurious warning avrdude: jtagmkII_initialize(): Cannot locate “flash” and “boot” memories in description would come up every time code is being uploaded.

I have also noticed this in other microcontrollers that used jtag2updi in an article here. Although this error is harmless, it impacts the end-user's (typically students) experience as they have to learn about the error and that it is not a fault of the device.

Would it be possible to suppress or eliminate this error in any particular configuration (e.g. through avrdude.conf)? I've did some digging and it appears that the error most likely originates from this section in the avrdude configuration file which did not define the memory "boot" section, which (to my loose understanding) is not needed in the ATmega4809, but needed for older XMEGA series chips which the 4809 was based on (now called megaAVR 0-series). The relevant piece of code avrdude should be somewhere around here

E.g. an XMEGA chip with a defined boot section
Screenshot 2021-12-26 at 7 49 53 PM

E.g. ATmega4809 with a user-definable boot section
Screenshot 2021-12-26 at 7 50 07 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.