avrdudes / avrdude

AVRDUDE is a utility to program AVR microcontrollers
GNU General Public License v2.0
728 stars 137 forks source link

New attiny404 unprogrammable (RSP_ILLEGAL_MCU_STATE) #1660

Closed nhansendev closed 8 months ago

nhansendev commented 8 months ago

I have a new attiny404 which I've tried programming with both a HV UPDI programmer and a DIY/arduino version, but both encounter the same error message: avrdude error: bad response to read memory command: RSP_ILLEGAL_MCU_STATE

I've been able to program attiny404s in the past, so my suspicion is that this particular one is in some way broken. On the PCB 5V is shared with the MCU and two low power LEDs, so I doubt that's relevant.

I've tried -e and -t -F, but the output looks the same. Are there any additional debug steps that I can try, or is it a lost-cause?

avrdude -c jtag2updi -P COM4 -b 115200 -p t404 -e -vvvv ``` avrdude -c jtag2updi -P COM4 -b 115200 -p t404 -e -vvvv avrdude: Version 7.2 Copyright the AVRDUDE authors; see https://github.com/avrdudes/avrdude/blob/main/AUTHORS System wide configuration file is C:\avrdude\avrdude.conf Using Port : COM4 Using Programmer : jtag2updi Overriding Baud Rate : 115200 avrdude: jtagmkII_open_pdi() avrdude: jtagmkII_getsync() avrdude: jtagmkII_getsync() attempt 1 of 10: 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 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 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- fuse1 bodcfg 0 0 0 0 no 1 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- fuse2 osccfg 0 0 0 0 no 1 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- fuse5 syscfg0 0 0 0 0 no 1 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- fuse6 syscfg1 0 0 0 0 no 1 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- fuse7 append 0 0 0 0 no 1 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- fuse8 bootend 0 0 0 0 no 1 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias 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 Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- lock 0 0 0 0 no 1 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- tempsense 0 0 0 0 no 2 1 0 0 0 0x00 0x00 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 Block Poll Page Polled Memory Type Alias 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 Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- sernum 0 0 0 0 no 10 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- osccal16 0 0 0 0 no 2 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- osccal20 0 0 0 0 no 2 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- osc16err 0 0 0 0 no 2 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- osc20err 0 0 0 0 no 2 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- data 0 0 0 0 no 0 1 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- userrow usersig 0 0 0 0 no 32 32 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 0 0 0 0 no 128 32 0 0 0 0x00 0x00 Block Poll Page Polled Memory Type Alias 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 Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- fuse4 tcd0cfg 0 0 0 0 no 1 1 0 0 0 0x00 0x00 Programmer Type : JTAGMKII_UPDI 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 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 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] . [80] . [07] . [01] . [02] . [00] . [00] . [00] . [00] . [00] . [00] ? [3f] . [00] s [73] l [6c] 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_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.00 s 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: . [02] avrdude: recv: . [00] avrdude: recv: . [00] avrdude: recv: . [00] avrdude: recv: . [0e] avrdude: recv: . [a5] . [00] avrdude: recv: E [45] avrdude: recv: . [97] avrdude: jtagmkII_recv(): got message seqno 9 (command_sequence == 9) avrdude: recv: . [a5] . [00] Raw message: 0xa5 0x00 Illegal MCU state: Stopped avrdude jtagmkII_program_enable() [jtagmkII.c:1111] warning: 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: . [02] avrdude: recv: . [00] avrdude: recv: . [00] avrdude: recv: . [00] avrdude: recv: . [0e] avrdude: recv: . [a5] . [00] avrdude: recv: B [42] avrdude: recv: A [41] avrdude: jtagmkII_recv(): got message seqno 10 (command_sequence == 10) avrdude: recv: . [a5] . [00] Raw message: 0xa5 0x00 Illegal MCU state: Stopped avrdude jtagmkII_program_enable() [jtagmkII.c:1111] warning: 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 Reading | -------------------------------------------------- | 0% 0.05 s avrdude jtagmkII_read_byte() [jtagmkII.c:2283] error: bad response to read memory command: RSP_ILLEGAL_MCU_STATE avrdude avr_read_mem() [avr.c:454] error: unable to read byte at address 0x0000 avrdude avr_read_mem() [avr.c:456] error: read operation not supported for memory signature avrdude avr_signature() [avr.c:1155] error: unable to read signature data for part ATtiny404, rc=-2 avrdude main() [main.c:1368] error: unable to read 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] . [01] avrdude: recv: . [d4] avrdude: recv: . [f4] avrdude: jtagmkII_recv(): got message seqno 12 (command_sequence == 12) avrdude: recv: . [a5] . [01] Raw message: 0xa5 0x01 Illegal MCU state: Running avrdude jtagmkII_program_disable() [jtagmkII.c:1157] error: 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 ```
mcuee commented 8 months ago

1) Just wondering if you are using the latest version of jtag2updi here. https://github.com/ElTangas/jtag2updi

2) Is the chip locked? https://github.com/avrdudes/avrdude/issues/1124#issuecomment-1280736407

https://github.com/ElTangas/jtag2updi/issues/66#issuecomment-1221566093

Hello, due to the way "-F" and "-e" options operate in avrdude, jtag2updi can't currently unlock chips that way. You need to enter interactive mode "-F -t" and then use the "erase" command.

Note: You must build jtag2updi with DISABLE_HOST_TIMEOUT defined for terminal mode to work.

nhansendev commented 8 months ago

You must build jtag2updi with DISABLE_HOST_TIMEOUT defined for terminal mode to work.

Thanks, I missed that before. I've modified the make.bat file and built the latest version of jtag2updi with DISABLE_HOST_TIMEOUT defined. Unfortunately, after updating the arduino UPDI programmer I get the same response as before.

As a sanity check I tried re-programming a known working attiny404 and there were no issues.

Is it weird that I get the same error regardless of the commands entered? (programming, erasing, terminal, etc.)

askn37 commented 8 months ago

Problem solving tips

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

avrdude jtagmkII_program_enable() [jtagmkII.c:1111] warning: bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE

For JTAG2UPDI, this error and an additional status 0x00 pair are output from:

https://github.com/ElTangas/jtag2updi/blob/07be876105e0b9cfedf2723b0ac88780bcae50d8/source/JTAG2.cpp#L249-L251

    default:
      // If we're somehow NOT in programming mode now, that's no good - inform host of this unfortunate state of affairs
      set_status(RSP_ILLEGAL_MCU_STATE, system_status); // return whatever system status caused this error

This system_status is obtained directly from ATtiny404 at the beginning of the "JTAG2::enter_progmode" function.

  const uint8_t system_status = UPDI::CPU_mode<0xEF>();

Under normal circumstances, this value will never be zero. There are several possible reasons for this.

mcuee commented 8 months ago

@nhansendev

I can only think that the chip is fried. But you can try the HV UPDI method mentioned by @askn37. If still not working, then the chip is probably damaged.

I will close this issue now. Please re-open if you find that there is an issue with avrdude later.

BTW, other than jtag2updi, you can also try serialupdi.

stefanrueger commented 8 months ago

Brilliant analysis @askn37 - Thank you

nhansendev commented 8 months ago

Problem solving tips

Thank you for such a thorough answer. Since I've already tried the high voltage option I'm going to assume it's simply broken.