ATmega8 in Uno Board

Hi there,

I would like to replace the ATmega328 from my arduino uno with an ATmega8. Is this possible? The one catch is that I do not have the ATmega328 to use as an ISP programmer (well, I do but it’s busy). However I do have a home-built USBasp and a target board for my ATmega8, which I can program using XtremeBurner.

Why, you ask? I can’t get hold of a replacement ATmega328, so I want to use my spare ATmega8. I want to use it in the Uno board to make use of the serial terminal (for debugging).

I have tried loading various bootloaders via the USBasp and then putting the ATmega8 into the Uno board. But when I try to program it via the Arduino IDE, it says it can’t communicate with the board. I’m not sure what board and other settings to choose.

I have many questions:

  • Which bootloader should I use? There are a bunch in the Arduino IDE sub folders.
  • Am I right to simply burn the bootloader .hex file with the USBasp?
  • Do I need to set the ATmega8 to use an internal clock (via the fuse bits)? I think it can only go up to 8MHz but the Uno board has a 16MHz oscillator…
  • What ‘Board’ and ‘programmer’ etc do I select in the Arduino IDE?

Any help would be much appreciated.

  • Tim

The MiniCore core will make bootlaoding the mega8 easier.

Here is a detailed reply on your topic: I'm damaged my atmega328P PU dip chip any alternate chip - Hardware - Arduino Forum

1 Like

Thanks for that!

Although so far this hasnt worked...

I added the MiniCore package and tried burning the bootloader (via Arduino IDE v1.8.19), with the atmega8 in my target board and my home-built USBasp. The options I selected were

  • Board: MiniCore > ATmega8
  • Clock: Internal 8MHz (I also tried 4MHz and 2MHz)
  • Programmer: USBasp (MiniCore) and also USBasp slow (MiniCore) with jumper inserted.

I always got the same error:

avrdude: Warning: cannot query manufacturer for device: No such file or directory
avrdude: Warning: cannot query product for device: No such file or directory
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
avrdude done. Thank you.
Error while burning bootloader.

So I'm thinking there is something weird with arduino IDE talking to my USBasp. So instead I downloaded the Minicore package and found the bootloader file: optiboot_flash_atmega8_UART0_115200_8000000L_B5.hex and loaded this via my USBasp and Xtremeburner. The write operation was fine. I then put the ATmega8 into the arduino Uno, but I cant seem to upload any sketches. I am using the blinker sketch from the example library and using the following settings:

  • Board: arduino AVR Boards > Arduino Optiboot w/ATmega8
  • Programmer: ArduinoISP - this doesnt seem right but there isnt a native 'Arduino Uno' option

I also tried the optiboot_flash_atmega8_UART0_19200_8000000L_B5.hex bootloader file but I always get the same error:

...
Warning: Board arduino:avr:opti8 doesn't define a 'build.board' preference. Auto-set to: AVR_OPTI8
....
Error while uploading: missing 'upload.tool' configuration parameter

Where is this configuration parameter set? Is there a better way to check if the chip is recognised by the board? Any further ideas?

Thanks for your help!

I just tried what you did by plugging a Atmega8 in my Uno and then I burned the (minicore) bootloader via a USBASP connected to the 6 pin ICSP header on the UNO board.
That worked flawless, so the first thing I would do if I were you is try out a different USB driver for your USBASP

I use Zadig to do that (Windows PC)

image

The driver that works for me is the libusbK (my current driver). When you check I suspect you have the WinUSB driver, that sometimes gives me trouble recognizing the USBASP.

When playing a bit with the AT8 UNO I noticed that after I upload a (blink ) test sketch via the bootloader I could not re-use the ICSP header to program via USBASP. I got the exact same error you had.

After that error I had to use Zadig again to reinstall the libusbK driver which enabled me to do burn bootloader again.

I extracted the bootloader from my AT8-UNO

at8 bootldr.h (19.3 KB)
(rename to at8 bootldr.hex)

How to set the fuses you can see in the avrdudess screenshot

I just wanted to reply to say thanks for your help! I got distracted after your last post and I never actually got back to this, but soon I should have some time again.

Just didn't want your effort to seem unappreciated - it very much is!

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