Making DIY “Arduino”

Hi, I’m trying to make a DIY “Arduino” using AtMega32-16au.(https://ww1.microchip.com/downloads/en/DeviceDoc/doc2503.pdf)
I see it has 32 I/O pins, and I’m wondering bow does the Arduino boot loader recognize them. Any help is appreciated.

Which boot loader?

What do you mean? The bootloader doesn't need to 'recognize' anything. You install the bootloader written for the chip.

Have you found an Arduino core already written for the ATmega32(L)?

It is a common misperception that the bootloader is where the Arduino magic happens. The bootloader is only a program that writes the application binary to the microcontroller's flash memory. That's all it does. The same bootloader could even be used if you didn't use the Arduino IDE or libraries at all. The bootloader has its own code for working with the I/O pins, for the communication interface it uses (e.g., UART), and perhaps to blink or fade the LEDs on the board, but this has nothing to do with the code you use in your sketch to control the pins.

As for the code that "recognizes" the I/O pins, that is actually part of the sketch program, not the bootloader. The question is far too ambiguous at this point to provide any specific reply, but you might start by looking at the core variant files for the board you are using.

1 Like

This third-party core says it covers the ATmega32:

Oh, I misunderstood it, I thought the bootloader which you can upload from the Arduino IDE needs to be modified to, for instance have pin PA0 to 0, PA1 to one, etc.

That is done by the core variant. For example, if you are using MightyCore and have Tools > Board > Pinout > Standard pinout selected from the Arduino IDE menus, it is done by this code:
https://github.com/MCUdude/MightyCore/blob/v2.1.3/avr/variants/standard/pins_arduino.h

1 Like

your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the IDE 1.x category.

It's the core that defines the relationship between a processor pin and the board pin. I've never looked at bootloaders for other cores but they are specific for a processor.

Hi, I made the "Arduino" board and connected everything. I uploaded Arduino as ISP sketch onto my Arduino Uno, chose atmega32 as my board, but when I hit burn bootloader i get this:

avrdude: Version 6.3-20201216
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is 
     "C:wherever"

     Using Port                    : COM2
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200
     AVR Part                      : ATmega32
     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         4    10    64    0 no       1024    4      0  9000  9000 0xff 0xff
       flash         33     6    64    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
       efuse          0     0     0    0 no          0    0      0     0     0 0x00 0x00
       lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
       calibration    0     0     0    0 no          4    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: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x000000 (retrying)

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

avrdude: Device signature = 0x000000 (retrying)

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

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

avrdude done. Thank you.

Error while burning the bootloader: Error: 2 UNKNOWN: chip erase error: uploading error: exit status 1

Any help?

Try adding a capacitor between RESET and GND on the programmer Arduino.

What capacity? And also, in the output it says oscillator off, could that be an issue?

@johnwasser Do you maybe know what's the problem?

Did you select Tools->Programmer->Arduino as ISP? It looks like "stk500v1" is selected.

Your Signature is not reading correctly. That usually means a wiring error or the system clock on the target processor isn't running. Is your chip expecting a crystal? Does it have one?

This is the correct protocol setting for the Arduino as ISP programmer:

1 Like

Hi, I think I found what was wrong(although I haven't tested it yet since I'm still at work), but when I come home I'll hook up the oscillator to an oscilloscope since I'm suspecting it is faulty. Thanks for the help.

SOLVED IT! When I connected the oscillator to the oscilloscope, it wasn't oscillating and upon closer inspection of the board, I realized that I connected a capacitor between the ground and xtal1 pin. All I had to do was de-solder it and it worked!

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