Having trouble reading fuse bits

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

Hello all,

Just started with AVR today!!

Anyways, I have an Arduino which I set up as an AVRISP.

I have an atmega8 microcontroller which I am trying to program. I am on Windows 7, and I have installed WinAVR.

I want to read the fuse bits, so I run this command:

avrdude -c avrisp -b 19200 -p m8 -P /dev/ttyUSB0 U- hfuse:r:high.bin U- lfuse:r:low.bin

It runs just fine, except it doesn't seem to generate any files from which I can read the results.

Is there something I am missing? Thanks, please let me know if more information is required. :)

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

You are on Win7 and your avrisp is on /dev/ttyUSB0?

Are you sure this is working? What is the device signature reported by avrdude?

U- is incorrect, it is -U.

Where did you copy that avrdude command from?

By the way, welcome to the forum. :)

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

Use the GUI that comes with Studio. And, there are stand-alone GUIs. They make it a whole lot easier.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

Jim, first he needs to find out where his AVRISP is in the device manager. Unless he is running linux in a virtual machine it is definitely not at /dev/ttyUSB0. :wink:

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

First off you have to use the correct serial port for your Arduino. On my Win7 PC, it is COM11

Just type this:

avrdude -c avrisp -P COM11 -b 19200 -p ATmega8

It should 'connect' and read the Signature.

If you want to see the fuses, an easy way is:

avrdude -c avrisp -P COM11 -b 19200 -p ATmega8 -v

But a more specific command is:

avrdude -c avrisp -P COM11 -b 19200 -p ATmega8 -U lfuse:r:-:h

or you may prefer binary:

avrdude -c avrisp -P COM11 -b 19200 -p ATmega8 -U lfuse:r:-:b

If you read the avrdude manual, you can see how to read or write fuses / memory sections in many formats.

Note that you can use "m8" as a short form for an ATmega8. Personally, I find it easier to write the full name.

Oh, and if you are on Linux, then /dev/ttyUSB0 might be the correct name for your serial port.

David.

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

First, I want to sincerely apologize for my awkward post. I am truly very very sorry.

I was using Windows 7 at the time I wrote up half of the post, and thought it was working. It wasn't, so I decided to switch to Linux. Still same result, it wasn't saving to the files high.bin and low.bin anywhere that I could find. Then I decided to continue with this question, and typed in the linux command I used (which was my second mistake).

I should have copy pasted it as per the rules on this forum (and as general good practice), but I didn't because I was posting this from my Windows machine :oops:

I guess that's the result of working 10 hours straight on something :D

Anyhow, David's method seems to have worked, although I am noticing something inconsistent. This is on Windows 7 WInAVR :)

I tried the first command

avrdude -c avrisp -P COM6 -b 19200 -p m8 -v

and receieved

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"

         Using Port                    : COM6
         Using Programmer              : avrisp
         Overriding Baud Rate          : 19200
         AVR Part                      : ATMEGA8
         Chip Erase delay              : 10000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
           flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0x00
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel AVR ISP
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.09s

avrdude: Device signature = 0x1e9307
avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as D9

avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as D9
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

When I run

avrdude -P COM6 -b 19200 -c avrisp -p m8 -U hfuse:r:-:h -U lfuse:r:-:h

I get

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9307
avrdude: reading hfuse memory:

Reading | ################################################## | 100% 0.03s

avrdude: writing output file ""
0xd9
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.03s

avrdude: writing output file ""
0xe1

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

So why is the first command telling me the hex values are 0x00 for both, whereas the second is telling me they are 0xd9 and 0xe1.

Thanks so much for helping out a beginner once again, I will definitely pay it forward :)

Last Edited: Thu. Jul 19, 2012 - 02:26 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are lying! Your first command was with the "-v". Hence the full report. (And your Arduino must be on COM6 !

David.

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

Sorry, meant to say I used your command, but pasted yours instead of mine. I edited it to reflect what I typed in. Thanks for catching that, you guys are sharp!

So any insight regarding the difference between the two?

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

Quote:

So any insight regarding the difference between the two?

You have lost me. The first:
Quote:

avrdude: Device signature = 0x1e9307
avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as D9


The second:
Quote:

avrdude: Device signature = 0x1e9307
avrdude: reading hfuse memory:
...
0xd9
avrdude: reading lfuse memory:
...
0xe1

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Ohh I see it now! They are the same! I have never used hex before, so I thought they were distinct.

I feel so stupid. Thank you for that, much obliged.