Self made ATMega32U4 board first programming

I'm stepping into Arduino world and decided to build a small board to implement a gamepad. Prior designing the board I tested my firmware on a Arduino Pro Micro USB (it worked) so I decided to make something similar.
My board use an ATMEGA32U4-AU instead ATMEGA32U4-MU because it's simpler to solder. Connecting the board to my PC I noticed a new device named ATmega32U4 appear between Windows devices this sounds like the board is working. Now the problem is how to program it with the correct bootloader (?) to act like an Arduino board (mainly for an easier programming).
While looking on the web the correct procedure to upload Arduino bootloader I had the evil ide to to burn over my board a precompiled firmware using Atmel FLIP (and it worked!) unlucky after this programming the running firmware blocked any other programming.
I found an old ArduinoISP and tried to install the bootloader on my board but this's what I got:

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\m.santucci\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : arduinoisp
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x2341-0x0049
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 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     : Arduino ISP Programmer
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.

Errore durante la scrittura del bootloader

I can clearly see that my firmware is not running when I start the booloader process (probably because it reset the board). From the log it seems that everything is going correctly until: programmer operation not supported

What does it means? Is the programmer unable to program such chip?
How can I fix this?
If I reset my board prior trying to burn again a new firmware over it will it work or I just have to put a brand new micro on it?

Best regards, Mike

weirdgyn:
From the log it seems that everything is going correctly until: programmer operation not supported

That message is normal when using an ArduinoISP programmer. Just ignore it.

The error message you need to focus on is this:

weirdgyn:

avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override
        this check.

As the error message indicates, this can be caused by incorrect connections between the programmer and the target microcontroller. Triple check all you connections.

weirdgyn:
Is the programmer unable to program such chip?

No, it can do it.

thnx for the answer but.. how can it detect correctly the microcontroller and then fail for a connection issue? I checked the connection and seems correct... mabye I can make wires shorter but nothing else... you have hints?

What part of the output makes you think it's detecting the microcontroller?

weirdgyn:
My board use an ATMEGA32U4-AU instead ATMEGA32U4-MU because it's simpler to solder. Connecting the board to my PC I noticed a new device named ATmega32U4 appear between Windows devices this sounds like the board is working. Now the problem is how to program it with the correct bootloader (?) to act like an Arduino board (mainly for an easier programming).

I have built a few projects using the Atmega32U4 (had to buy a pack of 10 MCUs - minimum order - and they were quite expensive at the time). Very convenient with the built-in USB to Serial bridge.

I use "Arduino as ISP (ATmegar32U4)" to burn the bootloader since my little DIY "programmer" actually uses a 32U4. For the new board I just select Arduino Leonardo as the board and burn the bootloader using Arduino IDE - worked every time.

Willem.

Willem43:
I have built a few projects using the Atmega32U4 (had to buy a pack of 10 MCUs - minimum order - and they were quite expensive at the time). Very convenient with the built-in USB to Serial bridge.

I use "Arduino as ISP (ATmegar32U4)" to burn the bootloader since my little DIY "programmer" actually uses a 32U4. For the new board I just select Arduino Leonardo as the board and burn the bootloader using Arduino IDE - worked every time.

Willem.

Can you detail what you did I'm a bit confused:

  1. you use one of your Atmega32U4 board to program other boards based on Atmega32U4?
  2. you use another ISP programmer based on ATMega32U4 (which one?) to program your board?

pert:
What part of the output makes you think it's detecting the microcontroller?

I tought this:

         AVR Part                      : ATmega32U4

also because the chip on ISP didn't look like an ATMega32U4... (at least not the packages I'm used to see).

That's just set by the command line argument passed to avrdude. If you check the command the Arduino IDE generates it will have an option: -patmega32u4.

If you unplug the ArduinoISP from your ATmega32U4 board and do a Burn Bootloader you'll see the exact same output.

pert:
That's just set by the command line argument passed to avrdude. If you check the command the Arduino IDE generates it will have an option: -patmega32u4.

If you unplug the ArduinoISP from your ATmega32U4 board and do a Burn Bootloader you'll see the exact same output.

ok thnx. I'll check again wirings... but it's probably a matter of length... 20cm maybe is too much.

weirdgyn:
Can you detail what you did I'm a bit confused:

  1. you use one of your Atmega32U4 board to program other boards based on Atmega32U4?
  2. you use another ISP programmer based on ATMega32U4 (which one?) to program your board?

I will try and explain a bit better.

  • I built a small board using a 32U4 (see picture) to be used as a dedicated ISP programmer.

    Using an UNO as ISP Programmer (running the ArduinoISP sketch), I burned a bootloader to this new board having set it as an Arduino Leonardo in IDE Tools.
  • Next I uploaded the ArduinoISP sketch to the new 32U4 board (treating it as an Arduino Leonardo) and am now using it as my ISP Programmer. Need to set the Programmer in IDE Tools as "Arduino as ISP (ATmega32U4)".

I hope that makes it a bit more readable.

Willem

Note that you can make most any Arduino board into an "Arduino as ISP" programmer. You can use your spare Pro Micro if you like.

Willem43:
Need to set the Programmer in IDE Tools as "Arduino as ISP (Arduino Leonardo)"

I think you meant "Arduino as ISP (ATmega32U4)".

pert:
I think you meant "Arduino as ISP (ATmega32U4)".

You are of course correct. I have fixed it in the above post.

Thanks

Willem