Uploading sketch to atmega8 through Arduino ISCP

Hi, I'm trying to upload sketch to my newly bought Atmega8. I burned OptiLoader Bootloader in my atmega using an Arduino.

In board manager, I installed MCUDUDE's MightyCores boards. There are few boards such as Atmega1284, Atmega644, Atmega324, Atmega164, Atmega32, Atmega16 and Atmega8535. But as I have a Atmega8A microcontroller, there's no name such as Atmega8A or just Atmega8. So, I'm little confused here and thought to ask arduino experienced community.

For trial, I select Atmega8535 with a led blink sketch then I got error as below when uploaded using Arduino ISCP

An error occurred while uploading the sketch
avrdude: Expected signature for ATmega8535 is 1E 93 08
         Double check chip, or use -F to override this check.

Please let me if you have gone through this and how you solved!

Thanks in advance!!

The core that you want is the MiniCore core by MCUdude. MiniCore is for the ATmega328, ATmega168, ATmega88, ATmega48 and ATmega8.

Hi, thanks for reply.

I installed Minicore and I was able to install bootloader in ATmega8 with Arduino Uno.
But when I tried to upload blink sketch I got below error

avrdude: Expected signature for ATmega8 is 1E 93 07
         Double check chip, or use -F to override this check.
Wrong microcontroller found.  Did you select the right board from the Tools > Board menu?

It's Atmega8A but I didn't find it in Tools->Variant->

Am I missing something?

I don't know. I don't see the A variant listed either.

I suggest that you flag this thread and have a moderator move it to the Microcontrollers section and try to get the attention of @MCUdude.

Or go the the MiniCore GitHub page and start an issue.

In Preferences, turn on "Show verbose output during: [ ] compilation [X] upload". One of the verbose messages will tell you what signature was received in place of the expected one. A signature of 00 00 00 or FF FF FF generally means the wiring is bad. If you get an ATmega328P signature (1E 95 0F) it means your UNO is resetting and you are talking to the UNO bootloader and not the ArduinoISP sketch. Put a 1uF (or higher) capacitor between Reset (+) and GND (-) on the UNO board to prevent that.

Sorry, I mistakenly flagged your post!
I'll flag mine!
Thanks!

I'm using 10k resistor between ATmega8A RESET pin and Ground pin.

I just got it working with AVRDude CMD tool.
The output was as below

avrdude -c arduino -b 19200 -p m8 -P COM4 -U flash:w:filename.hex


avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.09s

avrdude: Device signature = 0x1e9307 (probably m8)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "filename.hex"
avrdude: input file filename.hex auto detected as Intel Hex
avrdude: writing flash (854 bytes):

Writing | ################################################## | 100% 1.39s

avrdude: 854 bytes of flash written
avrdude: verifying flash memory against filename.hex:
avrdude: load data flash data from input file filename.hex:
avrdude: input file filename.hex auto detected as Intel Hex
avrdude: input file filename.hex contains 854 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.74s

avrdude: verifying ...
avrdude: 854 bytes of flash verified

avrdude: safemode: Fuses OK (E:FF, H:C4, L:BF)

avrdude done.  Thank you.

I don't have any idea why its having with Arduino IDE.

That is what the verbose messages were going to help with. :slight_smile:

I added 10uF capacitor between ATmega8A RESET Pin and Ground. Uploaded ArduinoISP sketch to arduino. I'm using 16Mhz crystal with 22pf disc capacitor. Connected ISCP connections properly and then selected ATmega8 from Minicore boards. Selected 16Mhz external crystal and finally selected programmer as Arduino as ISP(Minicore).

Compiled blink sketch and uploaded and I got following error with upload verbose ON

Arduino: 1.8.19 (Windows 10), Board: "ATmega8, Yes (UART0), EEPROM retained, BOD 2.7V, LTO enabled, External 16 MHz"

Sketch uses 720 bytes (9%) of program storage space. Maximum is 7680 bytes.

Global variables use 9 bytes (0%) of dynamic memory, leaving 1015 bytes for local variables. Maximum is 1024 bytes.

C:\Users\sunnyg\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\sunnyg\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf -v -patmega8 -carduino -PCOM4 -b115200 -D -Uflash:w:C:\Users\sunnyg\AppData\Local\Temp\arduino_build_862550/df.ino.hex:i 



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:\Users\sunnyg\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf"



         Using Port                    : COM4

         Using Programmer              : arduino

         Overriding Baud Rate          : 115200

         AVR Part                      : ATmega8

         Chip Erase delay              : 10000 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         4    20   128    0 no        512    4      0  9000  9000 0xff 0xff

           flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0x00

           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

           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00

           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00



         Programmer Type : Arduino

         Description     : Arduino

         Hardware Version: 3

         Firmware Version: 4.4

         Vtarget         : 0.3 V

         Varef           : 0.3 V

         Oscillator      : 28.800 kHz

         SCK period      : 3.3 us



avrdude: AVR device initialized and ready to accept instructions



An error occurred while uploading the sketch

Reading | ################################################## | 100% 0.00s



avrdude: Device signature = 0x1e950f (probably m328p)

avrdude: Expected signature for ATmega8 is 1E 93 07

         Double check chip, 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.

So, here AVRDUDE confusing with Atmega8A and the Arduino Programmer itself?

The capacitor goes on the UNO, not on your target. Add the capacitor after the ArduinoISP sketch is loaded.

When avrdude connects to the UNO, a LOW pulse is sent to the Reset pin to give control to the UNO's bootloader. The capacitor is to absorb that pulse so the UNO does not stop the ArduinoISP sketch to give control to the bootloader. The UNO bootloader and the ArduinoISP sketch both speak the same protocol so things don't go wrong until avrdude gets an unexpected signature.

The previous issue is solved and new issue has generated :sweat_smile:

First I upload ArduinoISP Sketch to arduino. Inserted 10uF capacitor between +Reset and -Ground. Tried to upload my blink sketch and waited for few sec (approx 7 sec uploading) and threw below error.

Arduino: 1.8.19 (Windows 10), Board: "ATmega8, Yes (UART0), EEPROM retained, BOD 2.7V, LTO enabled, External 16 MHz"

Sketch uses 720 bytes (9%) of program storage space. Maximum is 7680 bytes.

Global variables use 9 bytes (0%) of dynamic memory, leaving 1015 bytes for local variables. Maximum is 1024 bytes.

C:\Users\sunnyg\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino18/bin/avrdude -CC:\Users\sunnyg\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf -v -patmega8 -carduino -PCOM4 -b115200 -D -Uflash:w:C:\Users\sunnyg\AppData\Local\Temp\arduino_build_862550/df.ino.hex:i 



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:\Users\sunnyg\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.1.3/avrdude.conf"



         Using Port                    : COM4

         Using Programmer              : arduino

         Overriding Baud Rate          : 115200

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xe4

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe0

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe0

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe0

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe0

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xe0

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xe0

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe0



avrdude done.  Thank you.



Problem uploading to board.  See https://support.arduino.cc/hc/en-us/sections/360003198300 for suggestions.



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

Did you select programmer "ArduinoISP" or "Arduino as ISP"? I think it is the latter one you want.

Off Course, I used "Arduino as ISP" from the very beginning.

Do you have a stk500 starter kit?

I used to use the printer port in the old days for programing atmega chips. Now I use a USBasp programmer with the Zadig driver and AVRDUDESS to upload sketches.

STK500 is the protocol shared by the Arduino as ISP sketch and the Arduino UNO bootloader. It was created for early AVR ISP devices. STK500V2 is the extended version for larger memory, like the Arduino Mega.

Ahh thanks. I thought the he had clicked use stk500 programmer by mistake.

Hi, I solved it by myself by trying options in Arduino IDE->Tools

While uploading bootloader to ATmega8A you have to select YES(UART0) from Arduino IDE->Tools->Bootloader->YES(UART0)

Once bootloader is uploaded and you want to upload arduino sketch, Select No Bootloader from Arduino IDE->Tools->Bootloader->No bootloader

And you're good go!

1 Like

While uploading bootloader to ATmega8A you have to select YES(UART0) from Arduino IDE->Tools->Bootloader->YES(UART0)

There's no point in selecting "Bootloader: Yes (UART0)" if you're not going to use a bootloader for uploading programs. Instead, select "Bootloader: No bootloader" and then click the "Burn Bootloader" button. Now it's only setting the fuse bits, and not writing a bootloader.

I know it can be a bit confusing, but the Arduino IDE doesn't let 3rd party cores like MiniCore to change the label on the "Burn Bootloader" button. It says "Burn Bootloader" regardless of what 3rd part cores configures it to do...

1 Like

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