avrdude error in Atmel Studio 7: invalid file format...

Go To Last Post
32 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using a USBasp programmer on Windows 10, after a successful build, when I try uploading to my attiny85, it gives me this error:    avrdude.exe: invalid file format 'i>' in update specifier. 

Followed by this error:    avrdude.exe: error parsing update operation 'flash:w:c:\users\voidm\Documents\Atmel Studio\7.0\FirstAVRprogam\FirstAVRprogam\Debug\FirstAVRprogam.hex:i>'

 

The command I am using:    avrdude -c usbasp -p t85 -U flash:w:$(ProjectDir)Debug\$(TargetName).hex:i

 

It is encapsulated in "<", ">" in the Arguments of the external tool, but it seems to be including those symbols in the command.

 

It's my first time, I have all the latest drivers and whatnot and have followed this tutorial very thoroughly: https://circuitdigest.com/microc...

 

Is my command just wrong? Thanks so much for any help!

 

#define F_CPU 8000000UL 
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
    DDRB = (1 << PB0);
    while (1)
    {
        PORTB ^= (1<<PB0);
        _delay_ms(1000);
    }
}

This topic has a solution.
Last Edited: Sun. Oct 18, 2020 - 08:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the reply, following that tutorial gives me the same error:    avrdude.exe: invalid file format 'm>' in update specifier
avrdude.exe: error parsing update operation 'hfuse:w:0xD6:m>'    I even put the avrdude.exe in the same file structure and name as that tutorial. Oh and I forgot to mention I am on Windows 10.

 

 

Last Edited: Sat. Oct 17, 2020 - 05:21 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The tutorial tells you to put this in the Arguments field of AS7.0 External Tool

<avrdude -c usbasp -p atmega8 -U flash:w:$(ProjectDir)Debug\$(TargetName).hex:i> 

When you should just put

-c usbasp -p atmega8 -U flash:w:$(ProjectDir)Debug\$(TargetName).hex:i 

Obviously you change the device to -p ATtiny85

 

I find it more convenient to use the Target Directory field.   But the above method should work.

I would advise using a more modern avrdude.   But the old versions should work for the Tiny85

 

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well in the tutorial I looked at first it even had a screenshot with the angle brackets in the argument field.

 

I don't get that same error anymore but with your argument now it says this: 

 

avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: error: programm enable: target doesn't answer. 1 
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.

 

I installed a driver for my usbasp, is the firmware something different? Thank you for the reply. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.

just means that you have good Chinese firmware.   It is a good warning.

 Double check connections and try again, or use -F to override
             this check.

Follow the connection check.   Never use -F

 

I recommend anyone to buy an Arduino Uno clone.   Whether you want to develop programs with Arduino or not.

It is always handy to test new hardware.   And get prototype ideas running swiftly.

 

Connect the Arduino 3x2 ISP header to your USBASP 5x2.   Either by hand-routeing or with a 5x2 to 3x2 adapter.

Start the Arduino IDE.   Select Tools->Board, Programmer, Burn Bootloader.

 

This will verify that you have connections correct (and that the USBASP is  ok)

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok so I've got my Uno out. How exactly do I connect the 3x2 to the 5x2? And what does "burn bootloader" mean? That sounds scary. And shouldn't I just go straight to updating the firmware? I've checked my connections about 8 times now and I would bet money they are connected correctly lol I'm checking out some tutorials on using the Uno to update the firmware now  https://www.electronics-lab.com/...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

No,   you should not "update the USBASP firmware".   You have already got good Chinese firmware.     It is unwise to replace with inferior German firmware.

 

Regarding 3x2 and 5x2.

Most USBASP have a 5x2.   AVR Arduinos have a 3x2.   I strongly advise buying a ready made adapter.   Or making an Adapter with some male header strip and a scrap of Protoboard.

 

But you can hand wire with individual Dupont wires.   Note that pin #1 is marked with a square copper pad,  or a printed dot or arrow.

 

If you have selected Uno, USBASP in the Arduino IDE the "Burn Bootloader" will work if you have correct wiring.   Or give an error message if there is a problem.

 

David.

 

Last Edited: Sat. Oct 17, 2020 - 07:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok so my "burn bootloader" option is just under Tools, I tried it with the USBasp hooked up and it gives me this error   

 

"Error while burning bootloader.
avrdude: Error: Could not find USBtiny device (0x2a03/0x49)"

 

I double checked my connections, they are all correct. It says USBtiny but I can confirm that I am using a USBasp.

 

Also I hope you know I really appreciate you helping me!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In the IDE Tools menu select.

 

Tools->Programmer: Usbasp

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh lol well now it gives me this 

 

Error while burning bootloader.
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would re-install the Arduino IDE.   Then repeat my suggestion in #6 i.e.

Start the Arduino IDE.   Select Tools->Board = Uno, Programmer = USBASP, Burn Bootloader.

Report back.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I got the same exact error on my laptop. Edit: And the link it is providing is from some guy named Thomas, that doesn't sound Chinese lol The Ebay seller I bought it from is based in the US.

Last Edited: Sun. Oct 18, 2020 - 07:16 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are many millions of Arduino users.

There are probably 100,000 Arduino users that use USBASP.   The Arduino IDE has supported USBASP for many years.

 

Which is why I suggest that you re-install the Arduino IDE.   (your IDE version is probably due for an update anyway)

 

Thomas Fischl is the original designer of USBASP hardware (and firmware).   He is from Germany.

 

Chinese hardware has improved his original hardware design.   e.g. 3.3V and 5V operation.

Thomas's original firmware was very faulty. He has improved his firmware but it is still not as good as the Chinese firmware that comes with Ebay USBASP dongles.

 

I strongly advise you to NOT alter the Chinese firmware.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My laptop is a different computer, I am getting the same error on two different computers I don't think it is the IDE. But, I uninstalled it from my laptop, even deleting all associated files in AppData, did a fresh install, and I get the same error. Edit: Oh and I tested a blink program with it after installing and that worked fine.

 

This seems like a stupid question but just to make sure, I am supposed to have the Uno plugged into the computer, not the USBasp into the computer, right?

Last Edited: Sun. Oct 18, 2020 - 08:14 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1. Make a fresh install of the Arduino IDE.

2. Plug the Uno into USB

3. Build and Run Uno sketches.   e.g. to show that Uno and IDE is 100%

4. Unplug the Uno
5. Connect the Uno 3x2 to the USBASP 5x2 i.e. 6 wires

6. Plug USBASP into USB

7. Select Programmer=USBASP

8. Select Burn Bootloader

9. Unplug USBASP

10. Plug Uno

11. Run regular Uno sketches

 

The USBASP will power the Uno.   Usbasp dongles provide 5V on VCC by default.

You can power the Uno via USB.   Remove the VCC jumper on the USBASP

In practice,   the 5V Uno and 5V Usbasp both get the 5V from the same PC's USB ports.  

So jumpers don't matter.   You can have both Uno and Usbasp plugged into USB ports at the same time.

 

Please number each step that you make.

I assume that you have a regular Chinese USBASP.   Post a link if in doubt.

 

David.

Last Edited: Sun. Oct 18, 2020 - 08:46 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok so I clicked the burn bootloader option with the USBasp plugged into my computer and the Uno connected to the USBASP. It seems to have completed burning the bootloader but returned many warnings, all the same:  avrdude: warning: cannot set sck period. please check for usbasp firmware update.  

 

P.S. so is this like normally a way you would basically install the arduino bootloader onto an AVR? Or is this like just a way of programming one that already has the bootloader?

Last Edited: Sun. Oct 18, 2020 - 08:56 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That is absolutely normal.   Chinese firmware always gets: avrdude: warning: cannot set sck period

 

Now that the USBASP has been verified,  you can follow my AS7.0 instructions for the Tiny85.

 

It is still important that you connect the USBASP correctly to the Tiny85

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok now AS7 is giving me this:

 

avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: AVR device initialized and ready to accept instructions

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

avrdude.exe: Device signature = 0x1e930b
avrdude.exe: NOTE: FLASH memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
avrdude.exe: erasing chip
avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: reading input file "C:\Users\voidm\Documents\Atmel Studio\7.0\FirstAVRprogam\FirstAVRprogam\Debug\FirstAVRprogam.hex"
avrdude.exe: can't open input file C:\Users\voidm\Documents\Atmel Studio\7.0\FirstAVRprogam\FirstAVRprogam\Debug\FirstAVRprogam.hex: No such file or directory
avrdude.exe: write to file 'C:\Users\voidm\Documents\Atmel Studio\7.0\FirstAVRprogam\FirstAVRprogam\Debug\FirstAVRprogam.hex' failed

avrdude.exe: safemode: Fuses OK

avrdude.exe done.  Thank you.

 

This is my command, can I see what you would use?

-c usbasp -p t85 -U flash:w:$(ProjectDir)Debug\$(TargetName).hex:i

Last Edited: Sun. Oct 18, 2020 - 09:47 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrdude is recognised.

the target Tiny85 signature is read correctly

you have a missing HEX file.   (or it is stored somewhere else)

 

Look for your HEX file in the File Explorer.

Do you find? C:\Users\voidm\Documents\Atmel Studio\7.0\FirstAVRprogam\FirstAVRprogam\Debug\FirstAVRprogam.hex

 

I use

Arguments: -cusbasp -p t85 -Uflash:w:$(TargetName).hex:i

Initial Directory: $(TargetDir)

 

Are you in the UK ?

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

IT WORKS!laugh 

 

I was originally following two different tutorials and one told me to make a release configuration before uploading it, but of course, my command was looking in the Debug file. Your command is so much cleaner and works for whatever configuration so I am using that now.

 

ONE THING I did notice is that my blink delay is supposed to be 1,000ms, but it is more like 4 or 5 seconds, I made it only 100ms and now it is closer to a one second delay. Why is it so slow? Is that normal? (btw I am already marking your initial reply as the solution Thank you so much!)

 

And no I am a Yank.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I always put F_CPU into Properties->All Configurations->Symbols

 

And make sure that the chip is running at F_CPU.   e.g. XTAL, fuses, CLKPR, ...

 

You don't need a scope or Logic Analyser.   But a $10 Saleae clone is well worth the money.

 

Simply write a 1 second Blinky with _delay_ms(500) and count 100 blinks against your wristwatch.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If flash rate is /4 it's probably two things. One is a /8 because of CKDIV8 and one is a *2 because of two delays per cycle.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I do actually have a $10 Saleae clone. So you're saying I should test exactly what the frequency is? IDK what the other is saying but he says that it is either /4 or /8 or something, and counting just in my head, a 1000ms delay is taking about 8 seconds.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A delay of 1000ms is taking about 8 seconds, so it must be /8? How do I change that? Thank you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to change the DIV8 fuse to unprogrammed.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you, but I don't know what that means lol

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


No idea how to do it with avrdude better wait for someone who knows.

 

This is the fuse you want to uncheck

 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh ok no prob you guys are like the fastest most helpful forum I have ever been to lol I really appreciate all the help this would have been a nightmare on my own. Out of curiosity, why would that even be an option? To make 8 times slower? Why wouldn't the software engineer just divide it instead of using some function in a program? I mean I could just multiply it by 8 too? lol Seems pointless.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Power savings? If your board runs on batteries then a lower speed will save power. All of the 1000s of board I have made have the fuse turned off.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah ok I think I found a tutorial on burning the fuses and I am learning about fuses now too so I think I am good I don't want to abuse you guys lol you guys are way too kind thanks to everybody that helped me! I will definitely be coming back here! Much love, thanks again guys.

 

Update: I successfully turned the CKDIV8 off in avrdude https://www.ladyada.net/learn/av... was very helpful. Thanks again guys!

Last Edited: Mon. Oct 19, 2020 - 05:20 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I typically leave the CKDIV8 fuse programmed and control the clock prescale in my initialization code by writing the CLKPSn bits in the CLKPR register using the function defined in power.h:

 

	#include <avr/power.h>
    .
    .
    .
	clock_prescale_set(clock_div_1);	// Set clock for divide-by-1 
	

 

David