Setting fuses with avrdude - this should be easy, but...

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

Hi All...

From Googleing and reading and all, it seems that the command line below should work. But it seems vardude is thinking my hex number is a file name, and is trying to open it as a file. I checked the parameters, and they see right.

So what am I missing?

Thanks...

C:\>avrdude -Cavrdude.conf -patmega1284p -cstk500v1 -P\\.\COM16 -U lfuse:w:0xff:m -U hfuse:w:0xd6:m -U efuse:w:0xfc:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9705
avrdude: reading input file "0xff"
avrdude: writing lfuse (1 bytes):

Writing | | 0% 0.00s ***faile
d;
Writing | ################################################## | 100% 0.13s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xff:
avrdude: load data lfuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0xff != 0x00
avrdude: verification error; content mismatch

avrdude: safemode: lfuse changed! Was ff, and is now 0
Would you like this fuse to be changed back? [y/n] y
avrdude: stk500_cmd(): programmer is out of sync

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

Something seems to be wrongly connected. Or not connected at all. You try to do everything at once. You better start with something easy, like this:

avrdude -p atmega1284p -c stk500v1 -P\\.\COM16 -vvv
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kun.io wrote:
Something seems to be wrongly connected. Or not connected at all. You try to do everything at once. You better start with something easy, like this:
avrdude -p atmega1284p -c stk500v1 -P\\.\COM16 -vvv

Oh, boy, that was really stupid :-( I told ARVDude to talk to the FTDI chip on my board via COM16, not the AVR ISP MKii programmer plugged into my USB port.

Of course, with AS5 installed, AVRDude could not talk to my avr isp MKii programmer, and this thread helped solve that problem:

https://www.avrfreaks.net/index.p...

Its all working now, thank you!

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

Actually, one more odd thing I can't figure out how to fix...

I am using a DOS batch file to invoke avrdude twice. I want to do it twice, once to set the fuses on a new board using -B5 (because its slow for the new boards that are effectively running at 1MHz on their internal oscillator divided by 8) and then again, to install my app, but at a faster rate like -B1, because its big and who wants to wait all day?

Avrdude runs the first time successfully, but then when the bat file invokes it the second time, it complains:

avrdude: usbdev_open(): did not find any USB device "usb"

Of course this is the exact same port it just write to, and if I just invoke it twice from the command line, it works fine.

Is there a way around this?

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

skyjumper wrote:
Avrdude runs the first time successfully, but then when the bat file invokes it the second time, it complains:
[...]
Is there a way around this?
Just guessing here, but it almost sounds like a brief delay between commands would solve it. I haven't modified DOS batch files in many years, but a little Googling shows me that a 'sleep' command is available with the "Windows 2003 Resource Kit". Failing that, it seems that the common trick to get a delay in a batch file (assuming you don't want to use the 'PAUSE' command, which would require the user to hit some key to continue) involves use of a 'PING' command (adjust your delay accordingly, of course):
Top 10 DOS Batch tips wrote:
Pause execution for a number of seconds

There are different ways to do this from within a batch file, all with their tradeoffs. I use a ping to an invalid IP address with a timeout. The best way to do this is to find an invalid IP address and then ping it, but 1.1.1.1 is a pretty safe bet:

ECHO Waiting 15 seconds
PING 1.1.1.1 -n 1 -w 15000 > NUL

Hope that helps somehow. Good luck!

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

LOL, your timing is amazing... Just a few minutes ago I put a sleep 1 into the batch file and that did solve it, thank you!