1
\$\begingroup\$

I'm trying to connect to a pretty old Atmega328p that was sitting on a solderless breadboard for years. I'm using a TinyUSB programmer that also powers the MCU.

When I try to connect to it, I have the following message

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

I know this MCU is working since it still contains an old program on it and I can make it work.

I know the programmer works since on reset, I have some flashing LED (current flash program feature).

I've check connections, re-run avrdude, and had the following result:

$ avrdude -p atmega328p -c usbtiny  -vvvv

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/nico/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: 002:020
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  4500  4500 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  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    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
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, https://learn.adafruit.com/usbtinyisp
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [ff fe 53 00]
avrdude: AVR device initialized and ready to accept instructions

Reading |                                                    | 0% 0.00sCMD: [30 00 00 00] [30 00 00 00]
CMD: [30 00 01 00] [30 00 01 00]
Reading | #################                                  | 33% 0.00sCMD: [30 00 02 00] [30 00 02 00]
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000000 (retrying)

Reading |                                                    | 0% 0.00sCMD: [30 00 00 00] [f0 00 00 00]
CMD: [30 00 01 00] [f0 00 01 2a]
Reading | #################                                  | 33% 0.00sCMD: [30 00 02 00] [b0 aa fe ff]
Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x002aff
avrdude: Expected signature for ATmega328P is 1E 95 0F
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

It seems that either MCU is sending garbage or the ISP cannot read anything.

Without touching to anything, I ran avrdude again, but got the previous result: avrdude: initialization failed, rc=-1.

I need to add that within my multiple avrdude runs, I had one success where the Atmega328p was successfully recognized.

So, the MCU seems to work, the programmer can at least send a RESET signal that seems to work every time, but both of them cannot communicate.

I'm pretty stuck, and don't known what to do to understand what part is failing and solve this issue.

Edit

I checked conectivity of each SPI cable using a multimeter. I disconnected the SPI end of the cable and made sure I had current flowing from the SPI end of the cable to the leadframe of the MCU. It seems that I have connectivity on each of them.

Edit 2

I debugged the connections using an oscilloscope, here is the result (CH1: MSI, CH2: MISO):

enter image description here enter image description here

I tested this for two MCU, each one on a different solderless breadboard. Got similar results in both configurations.

I'm not sure how to interpret this result. MISO should be higher, isn't it ? I would say that the programmer is dead ?

\$\endgroup\$
4
  • \$\begingroup\$ That looks like connection issue indeed. Is your breadboard are solderless? \$\endgroup\$
    – NStorm
    Commented Jan 5, 2022 at 20:54
  • \$\begingroup\$ The breadboard is indeed solderless, and pretty old. I did check connectivity but could not find any obvious problem (more details at the end of the question post). Maybe the method used (multimeter) is not the best one to handle this sort of connectivity issue ? \$\endgroup\$ Commented Jan 6, 2022 at 6:47
  • 1
    \$\begingroup\$ Definitely not the best. You'll need an oscilloscope to see how signal might gets corrupted due to poor connection. Try lowering the SCK clock rate with -B 20 key (currently avrdude reports 10 usec for SCK, setting it to 20 will slower it 2 times, you can also try higher values). If your programmer supports it, it might help. \$\endgroup\$
    – NStorm
    Commented Jan 6, 2022 at 8:20
  • \$\begingroup\$ Thanks, I just debugged the connection with an oscilloscope, details added in Edit 2. Lowering SCK clock rate did not change anything \$\endgroup\$ Commented Jan 8, 2022 at 10:03

1 Answer 1

0
\$\begingroup\$

Jumper JP3 was not set.

I thought it was since the AVR was powering the LED the circuit had.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.