platformio / platform-atmelavr

Atmel AVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelavr
Apache License 2.0
136 stars 104 forks source link

Inherited workaround in avrdude.conf causes upload fail to ATmega8 #272

Open Cheesus13 opened 2 years ago

Cheesus13 commented 2 years ago

When I tried to upload my code in ATmega8 using usbasp I got the error:

avrdude: safemode read 1, efuse value: ff
avrdude: safemode read 2, efuse value: d9
avrdude: safemode: Sorry, reading back fuses was unreliable. I have given up and exited programming mode
avrdude: usbasp_close()

avrdude done.  Thank you.

*** [upload] Error 1

This mistake caused by the inherited workaround from Arduino IDE. The lines 6517-6522 of the avrdude.conf from .platformio/packages/tool-avrdude/:

    # Required for Arduino IDE
    # see: https://github.com/arduino/Arduino/issues/2075
    #      https://github.com/arduino/Arduino/issues/2075#issuecomment-238031689
    memory "efuse"
        size            = 0;
      ;

After removing these lines the problem was solved:

avrdude: safemode: lfuse reads as BF
avrdude: safemode: hfuse reads as C4
avrdude: safemode: Fuses OK (E:FF, H:C4, L:BF)

avrdude done.  Thank you.
MCUdude commented 2 years ago

@valeros this issue can be resolved by removing

    # Required for Arduino IDE
    # see: https://github.com/arduino/Arduino/issues/2075
    #      https://github.com/arduino/Arduino/issues/2075#issuecomment-238031689
    memory "efuse"
        size            = 0;
      ;

from the Avrdude.conf fine used by avrdude. It's a hacky workaround t get it working with Arduino IDE, and not needed by PlatformIO.