*** [upload] Error 1 with Atmega8

Hi,

I wanted to do something with microcontrollers again after few years, but I’m facing the problem which prevents me from having fun. After compiling my code, there’s no way to upload it to Atmega8. This is the message I get, when I try to upload it to Atmega:

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/ATmega8.html
PLATFORM: Atmel AVR 1.15.0 > ATmega8/A
HARDWARE: ATMEGA8 16MHz, 1KB RAM, 7.50KB Flash
PACKAGES: 
 - tool-avrdude 1.60300.190424 (6.3.0) 
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/ATmega8/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.0% (used 0 bytes from 1024 bytes)
Flash: [          ]   0.9% (used 66 bytes from 7680 bytes)
Configuring upload protocol...
AVAILABLE: usbasp
CURRENT: upload_protocol = usbasp
Looking for upload port...
Uploading .pio/build/ATmega8/firmware.hex

avrdude: error: program enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

*** [upload] Error 1

My platformio.ini file looks this way:

[env:ATmega8]
platform = atmelavr
board = ATmega8
upload_protocol = usbasp
upload_flags =
-Pusb

I use (as you see in .ini file) usbasp as my programmer, IDE is vscode + platformio, OS is Ubuntu 18.04. I checked connections five times, everything is fine. I have capacitors on voltage inputs.
I tested also Atmega32 and Atmega328P, same problem. I have no idea what’s wrong. I used different USB ports, same result. What other solutions should I try?

Are you able to program the chip using other tools, such as Atmel studio?

Can you show a wireup and / or picture of the hardware setup, especially the connections between the programmer and target chip?

Atmel Studio is for Windows only, I can’t check if this IDE would change anything. Few years ago when I was using Windows 10 and Eclipse, the same exact chip and programmer worked without any problems.
I got pics. Maybe you will see something I missed. Here are links to the pictures:

Remaining 2 links, because I can’t give more than 2 links in 1 reply

  • Using a multimeter, can you make sure the supply voltage between GCC and VCC is 5V?
  • Do you remember whether the chip was configured to use a crystal oscillator via the fuses? Your setup doesn’t have one. If the chip is configured to use one, it won’t start up (except high-voltage programming which is a different story)
  • Looking at How to Program an AVR chip Using a USBASP (10-pin Cable), are you 100% sure that all cabling is correct? I personally often made the mistake that I flipped the left and right side when wiring. You can check for GND continuity and VCC voltage to check whether your cabling is right.
1 Like

I checked it once again, and voltage is still around 4.98-5V, wires are fine. I never used crystal oscillators.

Can you provide the output for a Verbose Upload (Redirecting...)?

Hi there, I had the same problem and I solved it with replacing the avrdude with a new one downloaded from
http://download.savannah.gnu.org/releases/avrdude/
Good luck

1 Like