SOLVED: Problem burning bootloader to custom arduino board

Hello,

I have been working on creating a custom Arduino board based on the schematics for the Pro Mini. I recently got some PCBs fabricated by OSHpark and I soldered on the components, but I have been unable to burn a bootloader to the chip. This is what I get when I try:

Arduino: 1.8.9 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328P (3.3V, 8 MHz)"

C:\Users\avsor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\avsor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -cusbtiny -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m 

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 "C:\Users\avsor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         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
           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 : USBtiny
         Description     : USBtiny simple USB programmer, https://learn.adafruit.com/usbtinyisp
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
Error while burning bootloader.
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

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

I have tried checking if I had swapped MOSI and MISO, I made sure that I was connecting to RST and not DTR, etc, but I have still had no luck making it work. The interesting part here though is that I was able to get it to work on the last version of the board that I made (the only difference between the two versions is the silkscreen, all the traces are exactly the same) without any modifications to the way I was burning the bootloader. I am using Sparkfun's Pocket AVR programmer, and the chip is an ATmega328P (I have verified that it is indeed an ATmega328P and not an ATmega328). Could anybody help me out with this, or does anybody know what the problem could be? I have attached my EAGLE schematic for the board. Thanks.

Try to switch on the more detailed log for upload in the preferences an post it.
Double check connections but do not use -F.

Accidentally messed up the post the first time, so here it is again.
More detailed output log:

    Arduino: 1.8.9 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328P (3.3V, 8 MHz)"

C:\Users\avsor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\avsor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -cusbtiny -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m 

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 "C:\Users\avsor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         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
           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 : USBtiny
         Description     : USBtiny simple USB programmer, https://learn.adafruit.com/usbtinyisp
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

Error while burning bootloader.

I am certain that my connections are not the issue. I have used the exact same setup, with the exact same wiring, on a previous version of the board, and it worked. The only difference between the new version and the old version is the silkscreen layer. Both the schematic and the board layout are exactly the same between the two versions.

This is not detailed. Are you sure? I mean, there should be some transferred bytes visible.
I see just one -v in the command. It’s the same as previous.
Or, you could use directly the command from the top with -vvv in CMD (command line).

It does appear to be the same as the last one. I’m not sure that enabling verbose output during compilation actually made a difference in the output.

I tried using avrdude from the CMD, and this is what I get:

C:\Users\avsor>C:\Users\avsor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17\bin\avrdude -CC:\Users\avsor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -v -patmega328p -cusbtiny -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

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 "C:\Users\avsor\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         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
           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 : 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 ff ff ff]
CMD: [ac 53 00 00] [ff ff ff ff]
CMD: [ac 53 00 00] [ff ff ff ff]
CMD: [ac 53 00 00] [ff ff ff ff]
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

I am starting to suspect that this is an issue with the PCB itself, but I am not sure. I am going to try moving the components from the board that is not working onto the previous version of the PCB to make sure that the components I am using are not at fault.

Have you buzzed out the solder connections to make sure there no pins shorted or open/unconnected? Especially on the 328P?

I’m not sure what you mean by buzzing out the solder connections, but this is the second board I have made with this version of the PCB, and neither one worked.

I have checked for any solder bridges using a magnifier. There do not appear to be any.

A few photos will establish a baseline of how well you solder. Nobody knows how well you solder so it’s very fair that this skill is being questioned, like by CrossRoads. If you didn’t change your design, but somehow the newer design didn’t work but the older design works, it could be your soldering like CrossRoads mentioned. After all, the older design could mean just up to 3 boards you soldered, not sure how many you did before this point. Without a good hi-res image, nobody can tell if you solder well or poorly. Did you use a stencil?

Then you should share your design schematic and board files, at least screen shots. Without those “apparently correct” things, we can’t find where you may have made a mistake.

By buzzing out, I mean use a multimeter and check that adjacent pins are not shorted, and that connections from pins to IO connectors are solid; press very lightly on a component leg, confirm that it makes contact elsewhere. Very lightly, so that if it isn’t soldered, the pressing action does not press it against the board to make contact while you are measuring.

Schematic and layout would be helpful for review as Dr Liu points out.

A screenshot of my schematic is in the original post, but here it is again:

Top layer of the board:
Screenshot 2021-04-18 122747
bottom layer of the board:
Screenshot 2021-04-18 122843

Picture of the top of my board:


Picture of the bottom of my board:

The solder bridge on the back of the board was the location of a 0.1uF capacitor. I bridged it so that the DTR pin would function as the RST pin.

The trace jumper on the back of the board is to disable or re-enable the power indicator LED.

The tiny pad on the back of the board connects directly to the 328’s reset pin (PC6). I had intended to use this pad when burning the bootloader, but I ended up bridging the capacitor on the DTR pin in order to make sure all my connections were reliable.

I did not use a stencil. For the chip, I just manually soldered it using my soldering iron. For all the other components, I put solder on the pads and used a hot air gun to melt the solder when I was ready to add a component on the board.

Additional pictures of my board, in close up:


I did not try to get the position of each of the tiny capacitors on the back of the board exactly perfect because I was afraid of ripping up the pads (it has happened to me before).

Whoops.

Looks like my soldering is at fault here. MOSI and SCK were not connected to the pads properly. I’m probably going to check the rest of my pads now.

Thanks for the help!

No 0.1uF decoupling caps for U2, that’s not good design.

Glad you found the soldering issue.

You’re right. At least from the photo you didn’t solder on SCK:
image

If you have a scope, check whether your crystal is working. I can’t tell if it’s soldered on well enough. It’s supposed to be reflowed with solder paste. I also suggest some nice tacky flux on the all sides of your MCU. You have lots of residue of solder paste everywhere. You need to pick that up with your iron tip. Also see if you can use soap and water and a toothbrush to get rid of them. Dry your circuit before wiring it up of course.

I would probably try a stencil just to see the difference in quality of the soldering. This board looks neat, albeit some solder crud. Your soldering skill isn’t bad but could improve, with the use of tacky flux, by a lot. I recommend you to move the crystal to the same side of your MCU and don’t have any traces running under the crystal, as per design requirement. This way you can also just do one stencil for the MCU side because it’s hard to solder the crystal by hand. Anyway, if you get to make this at a larger quantity, get yourself a toaster oven and reflow the boards.

If you mean to have decoupling capacitors for the power that is supposed to be going to the board, I was told that instead of using two separate 0.1uF caps, it was ok to use a 0.2uF cap instead to conserve board space. In the schematic, that is C1.

I used a stencil the very first time I made one of these boards, just because I was uncomfortable soldering on 402 SMD components. I just hand-soldered this one for testing purposes, but I will definitely be reflowing them if I ever want to make larger batches.

I would, but I eventually had to put it on the opposite side of the board to minimize the size. I’m trying to keep the board as small as I realistically can, which would be within the confines of the pin headers.

I will see what I can do about that. The board layout was done with the auto-router, and as of right now, I really don’t have anywhere to move those traces to.

I don’t really have any problems with soldering the crystal, as I just put some solder on the pads and melt it using a hot air gun, while lowering the crystal onto the board.

Thanks to both you and CrossRoads for the help.

This application note
Atmel AVR042: AVR Hardware Design Considerations

directly contradicts your guidance on the 0.2uF decoupling cap

“For devices with multiple pairs of power and ground pins, it is
essential that every pair of pins get its own decoupling capacitor.”

Your design should have 3 0.1uF caps for VCC, VCC, and AVCC.
As it is, there is just one of 0.2uF.

I revised my schematic so that each of the VCC pins has its own 0.1uF cap. Does this look good?

One more question - if I include a ground plane in my board layout, is it advisable to still connect all the ground pins with traces, or can I let them be connected by only the ground plane? I ran the autorouter just to see how many of pins I could get connected, but I ended up with an airwire that seemed impossible to route. I would prefer to not connect the ground pins with traces, but rather with the ground plane, so that I have more room for other connections.

Edit: the resonator is now Y1. Just a note in case anybody points that out.

I use ground plane on both sides, with vias Name’d GND to connect them to each other and to connect any islands of Gnd plane that might be left from traces. Often moving a trace a little will allow more Gnd plane to flow as well. The only time I see Gnd traces is when a short trace is needed coming off of something thin like a TQFP pin to adjacent Gnd plane.

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