How to set fuses [file]

Hello,
When I run platformio.exe run --target fuses, PIO gets output Do not know how to make File target 'fuses' (D:\.Dokumenty\PlatformIO\atMega_Therm\fuses).
How can I use this?
Thx

What is the platformio.ini for this project?

I make everything copy&paste from docs with changed f_cpu and fuses.
My files:
platformio.ini

[env:ATmega328P]
platform = atmelavr
board = ATmega328P
framework = arduino
board_build.f_cpu = 8000000UL

lib_deps = 
    OneWire
    DallasTemperature

extra_scripts = extra_script.py

and extra_script.py

Import('env')
env.Replace(FUSESCMD="avrdude $UPLOADERFLAGS -e -Ulock:w:0x3F:m -Uhfuse:w:0xDA:m -Uefuse:w:0xFD:m -Ulfuse:w:0xE2:m")

And retuns some warn

I can can confirm that this does not work as itā€™s shown in the documentation.

platformio.ini and extra_script.py with empty firmware logic also gives me

pio run -t fuses
Processing forum2 (platform: atmelavr; board: ATmega328P; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/ATmega328P.html
PLATFORM: Atmel AVR 1.15.0 > ATmega328P/PA
HARDWARE: ATMEGA328P 8MHz, 2KB RAM, 31.50KB Flash
PACKAGES: toolchain-atmelavr 1.50400.190710 (5.4.0), framework-arduinoavr 4.1.1, tool-avrdude 1.60300.190424 (6.3.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 11 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <OneWire> 2.3.4 (C:\Users\Maxi\Documents\stackoverflow_testing\.pio\libdeps\forum2\OneWire_ID1)
|-- <DallasTemperature> 3.8.0 (C:\Users\Maxi\Documents\stackoverflow_testing\.pio\libdeps\forum2\DallasTemperature_ID54)
|   |-- <OneWire> 2.3.4 (C:\Users\Maxi\Documents\stackoverflow_testing\.pio\libdeps\forum2\OneWire_ID1)
*** Do not know how to make File target `fuses' (C:\Users\Maxi\Documents\stackoverflow_testing\fuses).  Stop.
============================================= [FAILED] Took 1.72 seconds =============================================

@ivankravets Is that reproducable on your side? Has the command maybe changed?

1 Like

It does work for board uno.

So it seems to make a difference if the board definition declares fuses (like uno) or if it doesnā€™t (like ATmega328P).

1 Like

Yeah, I tried it out also but on a pro8MHzatmega328 and it seemed like it would work fine, but I didnā€™t have the programmer hooked up so it then failed to set/read the fuses (which I expected).

I have the same issue as [Mikolaj98p] or [maxgerhardt]. Are there any hints to solve this issue. My platformio.ini is set-up for Attiny85 with arduino framework, nothing special.

[env:release]
platform = atmelavr
board = attiny85
board_build.mcu = attiny85
board_build.f_cpu = 8000000L
framework = arduino
upload_protocol = usbasp
; each flag in a new line
upload_flags =
-Pusb

; to override default fuse with custom fuse settings use an extra script
extra_scripts = fuse_settings.py

With the introduction of the fuses target, it looks like the fuse values need to be configured like so in your platformio.ini:

; Arduino Pro Mini Atmega328 8Mhz
board_fuses.hfuse = 0xDA
board_fuses.lfuse = 0xFF
board_fuses.efuse = 0xFD

You may not even need the extra_scripts helper any moreā€¦ worth commenting that out and tryingā€¦ e.g. pio run -t fuses or the Set fuses project task (Iā€™d try it myself but donā€™t have willing victim or programmer handy atm).

I can confirm that it works as you wrote. I made some trials. Now everything needed for configuration is embedded in the platformio.ini - fantastic. Many thx for immediate help and support

1 Like

Fantastic :slight_smile: Means I can retire the extra_script Iā€™ve been using the next time I need to do the fuses! :slight_smile:

Doesnā€™t work for me :frowning:
platformio.ini :
[env:attiny85]
platform = atmelavr
board = attiny85
board_build.f_cpu = 8000000L
board_fuses.hfuse = 0xDF
board_fuses.lfuse = 0xE2
upload_protocol = stk500v2
; each flag in a new line
upload_flags =
-Pusb

But fuses are not set:
avrdude: Device signature = 0x1e930b (probably t85)
avrdude: erasing chip
avrdude: reading input file ā€œ.pio/build/attiny85/firmware.hexā€
avrdude: writing flash (264 bytes):

Writing | ################################################## | 100% 0.13s

avrdude: 264 bytes of flash written
avrdude: verifying flash memory against .pio/build/attiny85/firmware.hex:
avrdude: load data flash data from input file .pio/build/attiny85/firmware.hex:
avrdude: input file .pio/build/attiny85/firmware.hex contains 264 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.10s

avrdude: verifying ā€¦
avrdude: 264 bytes of flash verified
avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)
avrdude done. Thank you.

Anything I made wrong?

Are you actually setting the fuses? i.e. running the Set Fuses or Upload using Programmer and Set Fuses task? As the fuses should not be set during a normal upload.

1 Like

Ok. I didnā€™t know that you need a special task for this purpose.
I thought this would be done in a ā€˜normalā€™ upload if the additional lines with the fuse settings are defined in the platformio.ini file.
Running the special task ā€˜Set Fusesā€™ works.
Thanks for the fast help, but I could not derive this information from the docuā€¦

1 Like

During a ā€˜normalā€™ run of avrdude, it never sets the fusesā€¦ IIRCā€¦ thatā€™s why it also says ā€˜safemodeā€™ in relation to the fuses. But it is worth mentioning that in the platformio docs also, as it is somewhat unclear if youā€™re not familar with the behaviour of the underlying tools :wink: If youā€™ve come from Arduino IDE land, this is why you use the ā€˜Burn Bootloaderā€™ command on new parts (even those like the attiny85 which have no bootloader)ā€¦ as thatā€™s the only time avrdude is run in ā€˜set the fusesā€™ mode (or is that ā€˜light the fusesā€™?).

Correct. I like the platformio IDE very much (as it is a ā€˜realā€™ IDE in comparison with the Arduino IDE). And it is quite intuitive to use. Just setting the fuses was not that clear to me. The only thing Iā€™m missing now is some kind of simulator (like in AVRStudio). But maybe it is also already there and I was just too impatient to find out how it worksā€¦

Hi all.
Maybe iā€™m wrong, but i canā€™t no longer see ā€œSet fusesā€ option in Platformio Tasksā€¦
Is it possible it was removed from that menĆ¹ with new 2.0.1 Platformio??

What tasks does it have in the env:nanoatmega3283t environment?

Sorryā€¦ WHat do you mean?

Right there in the screenshot.

Then go to ā€œPlatformā€ eventually, too.

1 Like

Sorry, iā€™m a stupid :face_with_symbols_over_mouth:ā€¦ i didnā€™t see all the other commands in the bottom.
Many thanks.

1 Like