Loading...
Pages: [1]   Go Down
Author Topic: avrdude fuse settings for Uno Rev3?  (Read 346 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,  I am trying to find the fuse settings Arduino has for the Uno Rev 3 (uses the ATMega328p).

I think the command looks something like this (based on verbose mode of the Arduino IDE)
avrdude -c arduino -p m328p -P /dev/cu.usbserial-AD01V737 

However, I cannot find what the fuse settings are.  I expect to see something of the following form:
-U lfuse:w:0x60:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m

Where can I find this information?

Thanks
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 270
Posts: 17059
Available for Design & Build services
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The fuse settings are in boards.txt.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The fuse settings are in boards.txt.

Thank you - I had forgotten about that file.  However, when I used the low, high and extra fuse settings and got the following:

Code:
avrdude -c arduino -p m328p -P /dev/cu.usbserial-AD01V737  -U lfuse:w:0xff:m -U hfuse:w:0xde:m -U efuse:w:0x05:m

avrdude: AVR device initialized and ready to accept instructions

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

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

Writing |                                                    | 0% 0.00s ***failed; 
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.02s

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]

I'm really confused.  Is it really looking for an input file for 0xff based on these lines?

Code:
avrdude: load data lfuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes

for completeness, the boards.txt file has the following entries for the uno board

Code:
##############################################################

uno.name=Arduino Uno
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.speed=115200
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.core=arduino
uno.build.variant=standard

##############################################################
Logged

SF Bay Area (USA)
Offline Offline
Faraday Member
**
Karma: 80
Posts: 5513
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
avrdude -c arduino -p m328p -P /dev/cu.usbserial-AD01V737  -U lfuse:w:0xff:m -U hfuse:w:0xde:m -U efuse:w:0x05:m
You won't be able to modify (or even read) the fuses by using the bootloader; you'd need an external programming device (perhaps another Arduino running ArduinoISP.)
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
avrdude -c arduino -p m328p -P /dev/cu.usbserial-AD01V737  -U lfuse:w:0xff:m -U hfuse:w:0xde:m -U efuse:w:0x05:m
You won't be able to modify (or even read) the fuses by using the bootloader; you'd need an external programming device (perhaps another Arduino running ArduinoISP.)


ahhh, thanks.  didn't realize that.

However, if I have an Uno Rev3 board with a bootloader already installed, how would I modify my avrdude command to upload a sketch via the command line?
Logged

SF Bay Area (USA)
Offline Offline
Faraday Member
**
Karma: 80
Posts: 5513
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

avrdude -c arduino -p m328p -P /dev/cu.usbserial-AD01V737 -U flash:w:myfile.hex
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

avrdude -c arduino -p m328p -P /dev/cu.usbserial-AD01V737 -U flash:w:myfile.hex

hmmm, I must be doing something wrong as I don't see the arduino board do the "blinking led" that the program is commanding it to do.

Code:
avr-gcc -Wall -Os -DF_CPU=16000000L -mmcu=atmega8 -c main.c -o main.o
avr-gcc -Wall -Os -DF_CPU=16000000L -mmcu=atmega8 -o main.elf main.o
rm -f main.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
avr-size --format=avr --mcu=atmega328p main.elf
AVR Memory Usage
----------------
Device: atmega328p

Program:     136 bytes (0.4% Full)
(.text + .data + .bootloader)

Data:          0 bytes (0.0% Full)
(.data + .bss + .noinit)

and the result of the flash:
Code:
avrdude -c arduino -p atmega328p -P /dev/cu.usbserial-AD01V737  -U flash:w:main.hex

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "main.hex"
avrdude: input file main.hex auto detected as Intel Hex
avrdude: writing flash (136 bytes):

Writing | ################################################## | 100% 0.08s

avrdude: 136 bytes of flash written
avrdude: verifying flash memory against main.hex:
avrdude: load data flash data from input file main.hex:
avrdude: input file main.hex auto detected as Intel Hex
avrdude: input file main.hex contains 136 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.07s

avrdude: verifying ...
avrdude: 136 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

and here is main.c

Code:
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
    DDRD = 1 << 4;           /* make the LED pin an output */
    for(;;){
        char i;
        for(i = 0; i < 10; i++){
            _delay_ms(10);  /* max is 262.14 ms / F_CPU in MHz */
        }
        PORTD ^= 1 << 4;    /* toggle the LED */
    }
    return 0;               /* never reached */
}
Logged

SF Bay Area (USA)
Offline Offline
Faraday Member
**
Karma: 80
Posts: 5513
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you're trying to blink the pin13 LED, it's on D5, not D4...
Logged

SF Bay Area (USA)
Offline Offline
Faraday Member
**
Karma: 80
Posts: 5513
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I meant B5.   Cough.
Quote
MMCU   = atmega8
DEVICE     = atmega328p
That looks like a problem...
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I meant B5.   Cough.
Quote
MMCU   = atmega8
DEVICE     = atmega328p
That looks like a problem...

Great points.   I modified the sketch which worked in the Arduino environment but not on the command line.  When I used the hex file generated by Arduino, the command line worked.  So I think something is screwy with my compilation (or it is that MMCU issue you pointed out).  I'm almost there smiley
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

IT WORKED with MMCU=atmega328p

Thank you!!!!!!!!!!!!!!!   smiley-mr-green smiley-grin smiley smiley-razz smiley-cool
Logged

Pages: [1]   Go Up
Print
 
Jump to: