Recovering from failed bootloading (ATMega328PB-AU)

Dear all,

I am assembling some Siguino boards with some schematic changes as attached (v1_sch.pdf).

First, I successfully used the Nick Gammon loader in one of the boards (original Siguino schematic and PCB, removing the components not required on my project such as LDR and Hall Sensor) and using the Arduino UNO as ISP loader and Arduino IDE 1.8.13.

Then I moved to the second assembled PCB (like the schematic attached), and the load was not successful with Atmega_Board_Programmer:

Atmega chip programmer.
Written by Nick Gammon
Version 1.38
Compiled on Dec  3 2020 at 18:16:51 with Arduino IDE 10813.
Attemping to enter ICSP programming mode .....................................................
Failed to enter programming mode. Double-check wiring!
Type 'C' when ready to continue with another chip

So I tried to use the Arduino ISP... After some comings and goings, I installed the mod for ATMega328PB as suggested by this topic, and it still not worked.

Then, I moved back to the first board (that was successfully bootloaded with Nick Gammon loader), trying to identify if the problem was on second board's hardware or assembly (if ArduinoISP+mod works on the first board), but the first board stopped to work too.
Then I evidenced that I was using the wrong option for bootloading (Tools > Board: ATMega328PB External Clock), and did not change the Speed to 8MHz (used 16MHz as default), then the current output is:

Arduino: 1.8.13 (Windows 7), Board: "ATmega328PB External Clock, 16 MHz"

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude.exe -CC:\Users\gubertoli\AppData\Local\Arduino15\packages\m328pb\hardware\avr\1.1.4/tools/avrdude.conf -v -patmega328pb -cstk500v1 -PCOM9 -b19200 -e -Ulock:w:0xFF:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD6:m -Ulfuse:w:0xE2:m 

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\gubertoli\AppData\Local\Arduino15\packages\m328pb\hardware\avr\1.1.4/tools/avrdude.conf"

             Using Port                    : COM9
             Using Programmer              : stk500v1
             Overriding Baud Rate          : 19200
             AVR Part                      : ATmega328PB
             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
               flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
               lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

             Programmer Type : STK500
             Description     : Atmel STK500 Version 1.x firmware
             Hardware Version: 2
             Firmware Version: 1.18
             Topcard         : Unknown
             Vtarget         : 0.0 V
             Varef           : 0.0 V
             Oscillator      : Off
             SCK period      : 0.1 us

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude.exe: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)

Reading | ################################################## | 100% 0.02s

avrdude.exe: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)

Error while burning bootloader.
Reading | ################################################## | 100% 0.03s

avrdude.exe: Device signature = 0xffffff (probably .reduced_core_tiny)
avrdude.exe: Yikes!  Invalid device signature.
             Double check connections and try again, or use -F to override
             this check.


avrdude.exe done.  Thank you.

Then, I tried Nick Gammon loader on the first board again, but it now outputs the same as the first code above *"*Failed to enter programming mode. Double-check wiring!"

So, I think that the issue is that both boards (ATMega328PB) are now in a misconfigured situation :confused: .

I also tried this topic's suggestion to change avrdude arguments in the command line to bring them back without success (used baud rates 4000, 9600)...

Can someone please help me put the microcontrollers back to the situation of being capable of loading bootloader? :cry:
Any feedback on the procedure to use Arduino ISP is also welcome.

v1_sch.pdf (32.3 KB)

According the log from Arduino as ISP, you have shortage on ISP.

Budvar10:
According the log from Arduino as ISP, you have shortage on ISP.

Due to Vtarget and Varef 0.0 V ? Is not this related with the fact of bootloading the boards without proper configuration ?

I just tried another Arduino UNO as Loader (both Arduino as ISP and Nick Gammon loader sketches) with the same issue. From the hardware/assembly aspects, I think that at least the first board is correct because it worked already.

I found a good reference about this on AVR Freaks forum: Recovering from a "locked out" AVR

It seems like my case, I will study it and provide an anwser here if it works.

0xFFFFFF sig is usually wiring or assembly problem (MISO shorted high)

Arduino running Arduino as ISP sketch does not support reading VTarget and always reports 0V for that.

Just a heads-up...

I was unabled to recover the ATMega ICs :sob: , so I decided to redesign the board removing the accelerometer from SPI to I2C to keep just the ICSP using the SPI line aiming to avoid issues during assembly.

I also tried the step #4 from [TUT][SOFT] Recovering from a "locked out" AVR without success :confused:

To create a more robust process for bootloading and firmware loading I will create an specific 6-pin connector for ICSP... Please if any suggestion about how to address this firmware loading process, it will be welcome!

Hadn't looked at schematic before, else I'd have told you then - the problem is that you have another device on the SPI bus, but you don't have a pullup on it's CS line, so while the chip is in reset (which it is while you're trying to program it) the CS line floats and the other SPI device will fight for control of the bus.

A 10k resistor from that CS line (looks like PB2/arduino pin 10?) to Vcc should sort that out.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.