avrdude icon indicating copy to clipboard operation
avrdude copied to clipboard

jtagice3_tpi programmers not supported by Avrdude

Open MCUdude opened this issue 3 years ago • 10 comments

I have an old Xplained Nano ATtiny104 lying around, and to my surprise, I can't use the onboard mEDBG to program the target. This is because JTAG3 programmers in TPI mode has never been added, which means that neither the Pickit4, SNAP or the Atmel ICE can't be used to program TPI compatible AVRs.

Here's a relevant Avrfreaks discussion where @janegilruud has the same conclusion: https://www.avrfreaks.net/forum/need-help-using-attiny104-xplained-nano-mac

I did a quick look, and it seems TPI support is missing for all Atmel/Microchip tools, so that needs to be added. When that is done there will probably be a new type called "jtagice3_tpi", but for now that is missing so it won't help adding it to avrdude.conf.

Here's a discussion I found in a mailing list: https://www.mail-archive.com/[email protected]/msg04906.html

MCUdude avatar Jan 10 '22 20:01 MCUdude

Agreed, nobody ever wrote code for that.

dl8dtl avatar Jan 10 '22 20:01 dl8dtl

AFAIK, this is the public information Microchip provides regarding the jtag3 protocol and how TPI is implemented. From my understanding, TPI support has to be implemented through the stk500v2 protocol, similar to how ISP is already implemented on the jtag3.

https://onlinedocs.microchip.com/pr/GUID-33422CDF-8B41-417C-9C31-E4521ADAE9B4-en-US-2/index.html

MCUdude avatar Jan 11 '22 21:01 MCUdude

From my understanding, TPI support has to be implemented through the stk500v2 protocol, similar to how ISP is already implemented on the jtag3.

This seems correct to me.

The AVRISPmkII already correctly handles that. Inside stk500v2.c, this is called xprog as that's the PDI protocol name on the STK600 (which first implemented PDI) was dubbed. TPI is handled similarly.

dl8dtl avatar Jan 11 '22 21:01 dl8dtl

I stumbled across this document. I'll leave it here so I don't loose it. Might come in handy if I or someone else are going to give this a go some time:

http://ww1.microchip.com/downloads/en/DeviceDoc/50002630A.pdf

MCUdude avatar Jan 16 '22 12:01 MCUdude

Good. I guess it's basically the same what we have in the EDBG subdirectory of our atmel-docs, but back then, they only provided it as HTML.

dl8dtl avatar Jan 16 '22 21:01 dl8dtl

I just got my hands on ATtiny104XNANO in order to program ATtiny10.. and noticed that TPI is not available :-)

Do you know it FT2232 or xplainedpro driver supports TPI? I also have some of those boards around :-)

cederom avatar Apr 09 '22 19:04 cederom

Update: I made TPI work with ATtiny10 on FT2232H based interface, see https://github.com/avrdudes/avrdude/issues/928 :-)

cederom avatar Apr 10 '22 22:04 cederom

@janegilruud could it be that you might happen to have tile to look into this issue? I've really tried to come up with a solution several times, but every time I've given up after spending several evenings.

I've tried to look at the jtag3.c and stk500v2.c source code to see how the very similar jtagice3_isp is handled. However, the EDBG documentation is somewhat limited when it comes to the TPI documentation and how the programmer is initialized to speak TPI instead of the ISP, JTAG, PDI, dW, or UPDI.

All I know is that we'll have to call stk600_setup_xprog() after the programmer has been set up to speak TPI

For instance, in the documentation under section 7.4, all devices except TPI ones are mentioned.

Bottom line: I don't think I'm able to proceed without the help from someone more knowledgeable than me. Thanks!

MCUdude avatar Jun 28 '22 14:06 MCUdude

I've been a little preoccupied these last few days, but I'll find some time and take a look.

janegilruud avatar Jul 05 '22 09:07 janegilruud

@janegilruud that would be great, thank you! Please let me know if there's anything I can do to help. I have an Attiny10 and an Attiny104 I can test with, and I own a PK4, a SNAP and an ATtiny104 Xplained Nano board.

MCUdude avatar Jul 05 '22 11:07 MCUdude

@janegilruud

Just wondering if we have some updates here.

mcuee avatar Oct 23 '22 13:10 mcuee

A few weeks ago, Pymcuprog and Pyedbglib were updated to support more targets (thanks @xedbg!). Now we have preliminary support for TPI devices through the JTAG3/EDBG protocol. This is precisely what we'd like to replicate here.

I spent a few hours last night trying to replicate how pymcuprog initializes the programmer, but I didn't succeed. The obstacle I couldn't get across was that jtag3_getsync() in stk500v2.c returns -1 no matter what I do.

MCUdude avatar Nov 08 '22 07:11 MCUdude

Just a guess, what if you skip that check?

mcuee avatar Nov 08 '22 08:11 mcuee

It appears that the check is needed. I tried to comment this out, but then it fails further down the line.

MCUdude avatar Nov 08 '22 09:11 MCUdude

Which error message comes out (from down in the stack) at the point of failure? Edit: If you are using the mEDBG with TPI on that Xplained Nano... then the same 'rules' should apply as when using the Xplained Mini, since they are quite closely related...

xedbg avatar Nov 08 '22 22:11 xedbg

@xedbg I just updated the Xplained Mini ATtiny104 to the latest FW Studio 7 has to offer (1.07 IIRC).

I've pushed my test branch here: https://github.com/MCUdude/avrdude/tree/jtag3-tpi

Here's the output I'm getting when I leave jtag3_getsync() in there:

$ ./avrdude -cxplainedmini -pattiny104 -v

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

         System wide configuration file is /Users/hans/Downloads/avrdude/src/avrdude.conf
         User configuration file is /Users/hans/.avrduderc

         Using Port                    : usb
         Using Programmer              : xplainedmini
avrdude: found CMSIS-DAP compliant device, using EDBG protocol
avrdude: jtag3_edbg_recv(): no response available
stk500v2_jtag3_open() rv: -1
avrdude stk500v2_jtag3_open() error: unable to sync with the JTAGICE3 in ISP mode
avrdude main() error: unable to open programmer xplainedmini on port usb

avrdude done.  Thank you.

Here's the output when I'm bypassing it altogether:

$ ./avrdude -cxplainedmini -pattiny104 -v

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

         System wide configuration file is /Users/hans/Downloads/avrdude/src/avrdude.conf
         User configuration file is /Users/hans/.avrduderc

         Using Port                    : usb
         Using Programmer              : xplainedmini
avrdude: found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATtiny104
         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
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse                    0     0     4    0 no          1   16      0     0     0 0x00 0x00
           lockbits                0     0     0    0 no          1   16      0     0     0 0x00 0x00
           signature               0     0     0    0 no          3   16      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          1   16      0     0     0 0x00 0x00
           flash                   0     0   128    0 no       1024   16      0     0     0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description     : Atmel AVR XplainedMini in ISP mode
avrdude: jtag3_edbg_recv(): no response available
avrdude: jtag3_edbg_recv(): no response available
avrdude stk500v2_jtag3_recv() error: unable to receive

avrdude: stk500v2_jtag3_initialize() start
avrdude: jtag3_edbg_recv(): no response available
avrdude main() error: initialization failed, rc=-1
        - double check the connections and try again
        - use -B to set lower ISP clock frequency, e.g. -B 200kHz
        - use -F to override this check

avrdude: jtag3_edbg_recv(): no response available
avrdude stk500v2_jtag3_recv() error: unable to receive
avrdude: jtag3_edbg_recv(): no response available
avrdude: jtag3_edbg_recv(): no response available

avrdude done.  Thank you.

I've added #define SCOPE_AVR_TPI 0x14 to jtag3_private.h, but I'm not familiar enough with the protocol to properly initialize the programmer for TPI use.

MCUdude avatar Nov 09 '22 08:11 MCUdude

So it fails very early in the process. stk500v2_jtag3_open() is the where the connection is established, so it fails before anything is set up properly. Maybe the issue is in jtag3_open_common()?

MCUdude avatar Nov 09 '22 08:11 MCUdude

I just got the ATtiny104 Xplained Nano from Mouser Singapore (along with some other boards and chips).

The following is the output from git main.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -cxplainedmini -pattiny104 -v

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

         System wide configuration file is C:\work\avr\avrdude_test\avrdude_bin\avrdude.conf

         Using Port                    : usb
         Using Programmer              : xplainedmini
avrdude: found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATtiny104
         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
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse                    0     0     4    0 no          1   16      0     0     0 0x00 0x00
           lockbits                0     0     0    0 no          1   16      0     0     0 0x00 0x00
           signature               0     0     0    0 no          3   16      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          1   16      0     0     0 0x00 0x00
           flash                   0     0   128    0 no       1024   16      0     0     0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description     : Atmel AVR XplainedMini in ISP mode
         Vtarget         : 5.00 V
avrdude: jtag3_edbg_recv(): no response available
avrdude: jtag3_edbg_recv(): no response available
avrdude stk500v2_jtag3_recv() error: unable to receive

avrdude stk500v2_jtag3_initialize() error: part ATtiny104 has no ISP interface
avrdude main() error: initialization failed, rc=-1
        - double check the connections and try again
        - use -B to set lower ISP clock frequency, e.g. -B 200kHz
        - use -F to override this check

avrdude: jtag3_edbg_recv(): no response available
avrdude stk500v2_jtag3_recv() error: unable to receive
avrdude: jtag3_edbg_recv(): no response available
avrdude: jtag3_edbg_recv(): no response available

avrdude done.  Thank you.

With @MCUdude's test branch.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_tpi_jtag3 -cxplainedmini -pattiny104 -vv

avrdude_tpi_jtag3: Version 7.0-20221109 (c0ec6a5)
                   Copyright (c) Brian Dean, http://www.bdmicro.com/
                   Copyright (c) Joerg Wunsch

                   System wide configuration file is C:\work\avr\avrdude_test\avrdude_bin\avrdude.conf

                   Using Port                    : usb
                   Using Programmer              : xplainedmini
avrdude_tpi_jtag3: stk500v2_jtag3_open()
avrdude_tpi_jtag3: found CMSIS-DAP compliant device, using EDBG protocol
avrdude_tpi_jtag3: sending sign-on command: 0x80 (3 bytes msg)
                   AVR Part                      : ATtiny104
                   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
                     ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
                     fuse                    0     0     4    0 no          1   16      0     0     0 0x00 0x00
                     lockbits                0     0     0    0 no          1   16      0     0     0 0x00 0x00
                     signature               0     0     0    0 no          3   16      0     0     0 0x00 0x00
                     calibration             0     0     0    0 no          1   16      0     0     0 0x00 0x00
                     flash                   0     0   128    0 no       1024   16      0     0     0 0x00 0x00

                   Programmer Type : JTAG3_ISP
                   Description     : Atmel AVR XplainedMini in ISP mode
avrdude_tpi_jtag3: jtag3_getparm()
avrdude_tpi_jtag3: sending get parameter (scope 0x01, section 1, parm 0) command: 0x84 (6 bytes msg)
                   Vtarget         : 5.00 V
avrdude_tpi_jtag3: jtag3_getparm()
avrdude_tpi_jtag3: sending get parameter (scope 0x12, section 1, parm 32) command: avrdude_tpi_jtag3: jtag3_edbg_recv(): no response available

avrdude_tpi_jtag3: get parameter (scope 0x12, section 1, parm 32) command: timeout/error communicating with programmer (status -1)
avrdude_tpi_jtag3: jtag3_edbg_recv(): no response available
avrdude_tpi_jtag3 stk500v2_jtag3_recv() error: unable to receive

avrdude_tpi_jtag3: stk500v2_jtag3_initialize() start
avrdude_tpi_jtag3: jtag3_setparm()
avrdude_tpi_jtag3: sending set parameter (scope 0x12, section 0, parm 0) command: avrdude_tpi_jtag3: jtag3_edbg_recv(): no response available

avrdude_tpi_jtag3: set parameter (scope 0x12, section 0, parm 0) command: timeout/error communicating with programmer (status -1)
avrdude_tpi_jtag3 main() error: initialization failed, rc=-1
                  - double check the connections and try again
                  - use -B to set lower ISP clock frequency, e.g. -B 200kHz
                  - use -F to override this check

avrdude_tpi_jtag3: jtag3_edbg_recv(): no response available
avrdude_tpi_jtag3 stk500v2_jtag3_recv() error: unable to receive
avrdude_tpi_jtag3: stk500v2_jtag3_close()
avrdude_tpi_jtag3: jtag3_close()
avrdude_tpi_jtag3: sending AVR sign-off command: avrdude_tpi_jtag3: jtag3_edbg_recv(): no response available

avrdude_tpi_jtag3: AVR sign-off command: timeout/error communicating with programmer (status -1)
avrdude_tpi_jtag3: sending sign-off command: avrdude_tpi_jtag3: jtag3_edbg_recv(): no response available

avrdude_tpi_jtag3: sign-off command: timeout/error communicating with programmer (status -1)

avrdude_tpi_jtag3 done.  Thank you.

pymcuprog works fine.

(py39x64venv) PS C:\work\avr\pymcuprog> pymcuprog read -f t104_readback.hex
Connecting to anything possible
Connected to mEDBG CMSIS-DAP from Atmel (serial number ATMLxxx)
Debugger firmware version 1.7.10
Debugger hardware revision 0
Device mounted: 'attiny104'
No device specified.  Using on-board target (attiny104)
pymcuprog.nvm - WARNING -
pymcuprog.nvm - WARNING - AVR-TPI stack is in Alpha state
pymcuprog.nvm - WARNING - Expect some features to be missing
pymcuprog.nvm - WARNING -
Pinging device...
Ping response: 1E900B
Reading...
Data written to hex file: 't104_readback.hex'
Done.

mcuee avatar Nov 11 '22 11:11 mcuee

For a start, this output here: get parameter (scope 0x12, section 1, parm 32) indicates that it is attempting to read the "mega programming clock" - this is not relevant to TPI and will probably return FAILURE_NOT_SUPPORTED

xedbg avatar Nov 11 '22 14:11 xedbg

@xedbg thanks for the hint! I'll look into it as soon as the kids are in bed.

It would be amazing if we could resolve this before Avrdude 7.1 gets released (right before Christmas I think)! I'll try my best to make it happen

MCUdude avatar Nov 11 '22 16:11 MCUdude

For a start, this output here: get parameter (scope 0x12, section 1, parm 32)

This comes from the jtag3_print_parms1() function (in jtag3.c) where Avrdude attempts to print various information read from the programmer.

@xedbg I've pushed a few commits that comments out code that's causing invalid responses.

This is the output now:

$ ./avrdude -cxplainedmini -pattiny104 -vv

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

         System wide configuration file is /Users/hans/Downloads/avrdude/src/avrdude.conf
         User configuration file is /Users/hans/.avrduderc

         Using Port                    : usb
         Using Programmer              : xplainedmini
avrdude: stk500v2_jtag3_open()
avrdude: found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATtiny104
         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
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse                    0     0     4    0 no          1   16      0     0     0 0x00 0x00
           lockbits                0     0     0    0 no          1   16      0     0     0 0x00 0x00
           signature               0     0     0    0 no          3   16      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          1   16      0     0     0 0x00 0x00
           flash                   0     0   128    0 no       1024   16      0     0     0 0x00 0x00

         Programmer Type : JTAG3_ISP
         Description     : Atmel AVR XplainedMini in ISP mode
avrdude: jtag3_edbg_recv(): no response available
avrdude stk500v2_jtag3_recv() error: unable to receive

avrdude: stk500v2_jtag3_initialize() start
avrdude: jtag3_setparm()
avrdude: sending set parameter (scope 0x12, section 0, parm 0) command: avrdude: jtag3_edbg_recv(): no response available

avrdude: set parameter (scope 0x12, section 0, parm 0) command: timeout/error communicating with programmer (status -1)
avrdude main() error: initialization failed, rc=-1
        - double check the connections and try again
        - use -B to set lower ISP clock frequency, e.g. -B 200kHz
        - use -F to override this check

avrdude: jtag3_edbg_recv(): no response available
avrdude stk500v2_jtag3_recv() error: unable to receive
avrdude: stk500v2_jtag3_close()
avrdude: jtag3_close()
avrdude: sending AVR sign-off command: avrdude: jtag3_edbg_recv(): no response available

avrdude: AVR sign-off command: timeout/error communicating with programmer (status -1)
avrdude: sending sign-off command: avrdude: jtag3_edbg_recv(): no response available

avrdude: sign-off command: timeout/error communicating with programmer (status -1)

avrdude done.  Thank you.

However, the next part is to figure out how to set up stk500v2_jtag3_initialize() properly. This is how it currently looks, but it only works for AVRs with ISP. The commands probably has to be way different.

https://github.com/MCUdude/avrdude/blob/9cdeffdecb57c29e9e70d87b6bafdc9ee18d8968/src/stk500v2.c#L1274-L1353

MCUdude avatar Nov 11 '22 17:11 MCUdude

Yes, indeed :/ There are housekeeping calls which need to be made on the general-purpose debuggers, but many of those are optional on the mEDBG on kits. So working with a Xplained kit should make for a simpler start. But the bulk of the work needs to be done on the TPI protocol envelope (0x14) level. There are only a handful of config parameters (https://github.com/microchip-pic-avr-tools/pyedbglib/blob/main/pyedbglib/protocols/tpiprotocol.py#L63) and there are defaults in place for the Xplained kit, so those are also optional I realise the pymcuprog stub code only reads out the device ID, but it does so using a memory read (https://github.com/microchip-pic-avr-tools/pymcuprog/blob/eda95bdcc4a4cb4e4f442aa59a2d49c423dfd730/pymcuprog/nvmtpi.py#L37).

xedbg avatar Nov 11 '22 22:11 xedbg

It seems like the Xplainedmini TPI becomes unresponsive (instead of returning -1) when it receives a call/command that it doesn't recognize. The Xplainedmini ISP isn't like this, is it?

In order to match the messages sent in pymcuprog/pyedbglib, it seems like I can't use jtag3_setparm(), since this carries too much data, but instead use jtag3_command(). But this is again different than what's done to initialize the other JTAG3 interfaces (ISP, JTAG, PDI, UPDI)

MCUdude avatar Nov 11 '22 22:11 MCUdude

Well, technically these are three separate protocols in parallel: ISP on 0x11, TPI on 0x14 and all-the-rest on 0x12... so something is fishy in there, probably as a result of the onions of protocols stacked up here :| A set to (0x12, 0, 0) is really only relevant to operations in 0x12, not TPI on 0x14. The standalone debuggers arguably will be ok with this regardless, but the mEDBG was stripped down to aggressively to fit in that the host really unfortunately has to know that it (in this case) is a TPI medbg instance, which needs only housekeeping and TPI functionality (so nothing on 0x11 or 0x14). 32k flash has its limitations... (specially while someone is holding one's beer). To find this out, it should really use the DISCOVERY QUERY call for a command_handler list, and see which one it contains...

xedbg avatar Nov 11 '22 23:11 xedbg

Created PR #1205

janegilruud avatar Nov 30 '22 22:11 janegilruud

#1205 is now merged! 🎉

MCUdude avatar Dec 19 '22 21:12 MCUdude

WOW! CONGRATZ! I WILL TAKE A LOOK IN A FREE MOMENT :-)

when a release? :-)

cederom avatar Dec 19 '22 21:12 cederom

when a release? :-)

Avrdude v7.1 will probably be released by the end of December

MCUdude avatar Dec 19 '22 21:12 MCUdude

Initial testing results with today git pull main:

% uname -a
FreeBSD octagon 13.1-STABLE FreeBSD 13.1-STABLE #1 stable/13-n253256-09072186eec1: Fri Dec  9 22:47:42 CET 2022     root@octagon:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

% git log -5 --oneline
159d126 (HEAD -> main, origin/main, origin/HEAD) Update NEWS
95363a1 Terminal read improvements (#1209)
bbd3ed2 Merge pull request #1208 from stefanrueger/urclock-updi
b108546 Consider libedit only in interactive mode (#1207)
72f0975 Merge pull request #1206 from stefanrueger/nsafety

Cannot get to terminal on AtTiny104 XplainedNano:

% ./avrdude -c xplainedmini_tpi -p t104 -vv -t

avrdude: Version 7.0-20221214 (159d126)
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is /XXX/avrdude.git/build_freebsd/src/avrdude.conf
         User configuration file is /XXX/.avrduderc
avrdude yywarning() warning: programmer ktlink overwrites previous definition /XXX/avrdude.git/build_freebsd/src/avrdude.conf:758. [/XXX/.avrduderc:376]

         Using Port                    : usb
         Using Programmer              : xplainedmini_tpi
avrdude: jtag3_open_tpi()
avrdude: found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATtiny104
         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
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse                    0     0     4    0 no          1   16      0     0     0 0x00 0x00
           lockbits                0     0     0    0 no          1   16      0     0     0 0x00 0x00
           signature               0     0     0    0 no          3   16      0     0     0 0x00 0x00
           calibration             0     0     0    0 no          1   16      0     0     0 0x00 0x00
           flash                   0     0   128    0 no       1024   16      0     0     0 0x00 0x00
           sigrow                  0     0     0    0 no         16   16      0     0     0 0x00 0x00

         Programmer Type : JTAGICE3_TPI
         Description     : Atmel AVR XplainedMini in TPI mode
avrdude: jtag3_getparm()
avrdude: sending get parameter (scope 0x01, section 0, parm 0) command: 0x84 (9 bytes msg)
avrdude: sending get info (serial number) command: 0x81 (23 bytes msg)
         ICE HW version  : 0
         ICE FW version  : 1.07 (rel. 10)
         Serial number   : ATML2678020200009059
avrdude: jtag3_enable_tpi() is empty. No action necessary.
avrdude: jtag3_initialize_tpi() start
avrdude jtag3_command_tpi() error: [TPI] command Enter Progmode FAILED! Status: 0x03
avrdude main() error: initialization failed, rc=-1
        - double check the connections and try again
        - use -B to set lower ISP clock frequency, e.g. -B 200kHz
        - use -F to override this check

avrdude jtag3_command_tpi() error: [TPI] command Leave Progmode FAILED! Status: 0x01
avrdude: jtag3_close_tpi() is empty. No action necessary.

avrdude done.  Thank you.

Cannot get to terminal on AtTiny416 XplainedNano:

% ./avrdude -c xplainedmini_tpi -p t416 -vv -t

avrdude: Version 7.0-20221214 (159d126)
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is /XXX/avrdude.git/build_freebsd/src/avrdude.conf
         User configuration file is /XXX/.avrduderc
avrdude yywarning() warning: programmer ktlink overwrites previous definition /XXX/avrdude.git/build_freebsd/src/avrdude.conf:758. [/XXX/.avrduderc:376]

         Using Port                    : usb
         Using Programmer              : xplainedmini_tpi
avrdude: jtag3_open_tpi()
avrdude: found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATtiny416
         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
           ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           fuse0       wdtcfg      0     0     0    0 no          1    1      0     0     0 0x00 0x00
           fuse1       bodcfg      0     0     0    0 no          1    1      0     0     0 0x00 0x00
           fuse2       osccfg      0     0     0    0 no          1    1      0     0     0 0x00 0x00
           fuse4       tcd0cfg     0     0     0    0 no          1    1      0     0     0 0x00 0x00
           fuse5       syscfg0     0     0     0    0 no          1    1      0     0     0 0x00 0x00
           fuse6       syscfg1     0     0     0    0 no          1    1      0     0     0 0x00 0x00
           fuse7       append      0     0     0    0 no          1    1      0     0     0 0x00 0x00
           fuse8       bootend     0     0     0    0 no          1    1      0     0     0 0x00 0x00
           fuses                   0     0     0    0 no          9   10      0     0     0 0x00 0x00
           lock                    0     0     0    0 no          1    1      0     0     0 0x00 0x00
           tempsense               0     0     0    0 no          2    1      0     0     0 0x00 0x00
           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
           sernum                  0     0     0    0 no         10    1      0     0     0 0x00 0x00
           osccal16                0     0     0    0 no          2    1      0     0     0 0x00 0x00
           osccal20                0     0     0    0 no          2    1      0     0     0 0x00 0x00
           osc16err                0     0     0    0 no          2    1      0     0     0 0x00 0x00
           osc20err                0     0     0    0 no          2    1      0     0     0 0x00 0x00
           data                    0     0     0    0 no          0    1      0     0     0 0x00 0x00
           userrow     usersig     0     0     0    0 no         32   32      0     0     0 0x00 0x00
           eeprom                  0     0     0    0 no        128   32      0     0     0 0x00 0x00
           flash                   0     0     0    0 no       4096   64      0     0     0 0x00 0x00

         Programmer Type : JTAGICE3_TPI
         Description     : Atmel AVR XplainedMini in TPI mode
avrdude: jtag3_getparm()
avrdude: sending get parameter (scope 0x01, section 0, parm 0) command: 0x84 (9 bytes msg)
avrdude: sending get info (serial number) command: 0x81 (23 bytes msg)
         ICE HW version  : 0
         ICE FW version  : 1.13 (rel. 43)
         Serial number   : ATML2795042700003537
avrdude: jtag3_enable_tpi() is empty. No action necessary.
avrdude: jtag3_initialize_tpi() start
avrdude: jtag3_edbg_recv(): no response available
avrdude jtag3_recv_tpi() error: jtag3_recv_tpi(): unable to receive

avrdude: TPI Enter Progmode command: timeout/error communicating with programmer (status -1)
avrdude main() error: initialization failed, rc=-1
        - double check the connections and try again
        - use -B to set lower ISP clock frequency, e.g. -B 200kHz
        - use -F to override this check

avrdude: jtag3_edbg_recv(): no response available
avrdude jtag3_recv_tpi() error: jtag3_recv_tpi(): unable to receive

avrdude: TPI Leave Progmode command: timeout/error communicating with programmer (status -1)
avrdude: jtag3_close_tpi() is empty. No action necessary.

avrdude done.  Thank you.

Any hints welcome :-)

cederom avatar Dec 20 '22 00:12 cederom

ATtiny416 uses UPDI, not TPI. Wrong interface.

janegilruud avatar Dec 20 '22 07:12 janegilruud