I'm trying to use an Arduino Uno as a programmer to be able to flash code onto another ATMega32PB (on a separate board). I'm having issues transferring the code.
I verified that the ATMega32PB is getting 5V power and GND from the Arduino uno. In addition, I'm able to reset the Arduino from the RESET switch (LED on the Arduino Uno flashes again).
I made sure to select the target board as ATMega32PB (downloaded from a minicore Library) and I selected "Arduino as ISP."
The Arduino cannot detect the ATMega32PB. Does anyone have any suggestions?
You must upload this code to the board you are using as a programmer (the Arduino Uno in this case), not to the target board.
I'll provide instructions for the full process:
A. Prepare "Arduino as ISP" programmer
I will refer to the board which will used as an "Arduino as ISP" as the "programmer board" from here on. The board you are burning the bootloader to will be referred to as the "target board".
Disconnect the USB cable of the Arduino boards from your computer.
Make the following connections between the pins on the "programmer board" and the "target board".
ⓘ The documentation for the boards you are using will identify the location of these pins. If you are using an official Arduino board, check the pinout diagram on the documentation page for the board.
Connect the "programmer board" to your computer with a USB cable.
Select File > Examples > 11.ArduinoISP > Arduino ISP from the Arduino IDE menus.
Select Tools > Board > Arduino AVR Boards > Arduino Uno from the Arduino IDE menus.
Select the port of your "programmer board" from Arduino IDE's Tools > Port menu.
Select Sketch > Upload from the Arduino IDE menus.
Wait for the upload to finish.
You are now ready to burn the bootloader using your "Arduino as ISP" programmer.
B. Burn Bootloader
In addition to typically flashing a bootloader binary to the target board as the name implies, a "Burn Bootloader" operation also sets the configuration fuses on the target board according to the board configuration you have selected in the Arduino IDE menus. So you should perform a "Burn Bootloader" operation once (and again after making any relevant board configuration change) even if you don't need the bootloader itself (in fact, MiniCore even has a Tools > Bootloader > No bootloader" option, and if you have that option selected, a boot section will not be reserved, but the "Burn Bootloader" operation will still perform the important fuse setting).
Just to confirm, when we burn the bootloader, do we stay on the same Arduino file in which the Arduino ISP firmware was flashed onto the Arduino Uno or do we open up a new file?
It doesn't matter which sketch you have open in Arduino IDE at the time you perform the "Burn Bootloader" operation. That operation completely ignores the current sketch. It flashes a separate precompiled binary bootloader file independent from the sketch.