Difference between 0xDE and 0x:D6 (high fuses)

Hello,

In the eleccelerator.com site, the difference between 0xDE and 0xD6 in the high fuses is the 'Preserve EEPROM memory through the Chip Erase cycle' option. But, what is that supposed to mean? How can this option affect the functionality of the Arduino? Also, what are the standard high fuses for a normal Arduino Uno? In the boards.txt file, it says that they are 0xDE, but I just want to make sure.

Thanks in advance

When you Burn Bootloader or when you upload a sketch via ISP and use the -e option of avrdude, the flash memory is erased, and the EEPROM is erased. Programming the EESAVE fuse means erasing EEPROM is skipped. If you have a sketch that uses EEPROM and relies on the stuff stored there, there would be no erasure after you erase and program an updated sketch via ISP, if you have programmed the EESAVE fuse. It is a somewhat rare thing to get into these sorts of details with an Arduino, but not unheard of.

Yes DE is the default high fuse for an Uno if the bootloader has been installed and fuses set. Looking in the boards.txt file for that info is good.

If you are looking at an online fuse calculator, the "companion" information that goes with that is reading the data sheet for the ATmega328P.

Thanks a lot for your answer. Apparently, I changed my high fuses by accident. One of my sketches was not working properly for that reason. Thanks again.

So, I changed the high fuses back to DE, but the sketch still isn’t running. The sketch was not written by me and therefore I am not 100% familiar with it. The sketch was made to test if an Arduino functions properly. It does that by doing four tests. One for conditional operations, arithmetical, SRAM and flash. Below are the two later tests:

void run_flash_test()
{
  for(int repeat=0;repeat<1000;repeat++)
  {
    //flash_check
    for(unsigned char i=0;i<16;i++)
    {
      flash_check=(flash_check ^ svalue1) + svalue2;
      flash_check=(flash_check<<((svalue3+flash_check)&7)) + (flash_check>>((svalue3+flash_check)&7)) + svalue4;
    }
  }
}

void run_sram_test()
{
  for(int repeat=0;repeat<10;repeat++)
  {
    //SRAM check
    for(int i=0;i<2405;i++)
    {
      value1=(value1+value2+value3+value4+sram_check)&1;
      value2=(value2+value1+value3+value4+sram_check)&1+1;
      value3=(value3+value1+value2+value4+sram_check)&1+2;
      value4=(value4+value1+value2+value3+sram_check)&1+3;
      sram_check=(sram_check<<1)+(sram_check>>7)+value1+value2+value3+value4;
    }
  }
}

Sketch was written by Svarichevsky Mikhail, not me.

When everything works fine, it outputs specific values for sram_check and flash_check on an LCD display. If the screen displays some other numbers, then something is not right. But in my case, nothing is displayed on the screen. I am certain that the screen works perfectly fine. The same sketch was running normally some weeks ago. The only change I made since then is changing the extended fuses to 0xFF(disabled). My current fuses are E:FF, H:DE, L:FF.

Any help is really appreciated.

I suggest uploading the blink sketch, and see if that works OK. Start with the basics when you have made a change to the fuses or the board.

The blink sketch works fine. Also, the 'Hello World' with the LCD screen works.

OK in that case I suggest troubleshoot the bad sketch. Figuring out other people's sketches can be difficult. If you have any specific questions about various parts of the code you can start a thread in the programming questions part of the forum.

Also, I forgot to mention that the Arduino is provided only around 2.7 Volts. Could that be a problem? Is there any chance that the Arduino board is broken?

I don't know. If some sketches work and prove the basic hardware works, such as ability to upload and blink an LED and output successfully to the screen, then it seems to me like the sketch that won't work is bad. The Arduino board may be bad, but it seems unlikely.

There is no official arduino board intended for operation at 2.7v, as far as I know - most are 3.3 or 5.

What board are you using?

You haven't posted the entire sketch, only a snippet. It is impossible to assess why the sketch may or may not be working from the snippet.
If you want my guess, elsewhere in the sketch it's writing the flash and then reading it back, and failing to do so because you changed the extended fuse to disable self-programming, so it can't write the flash. But of course, that's just a guess because you DIDN'T POST THE DAMNED CODE.

Note that the EESAVE fuse does NOTHING unless you are uploading sketches via ISP or burning bootloader via ISP. If you upload sketches the normal way though the bootloader, no chip erase cycle is performed and the EEPROM contents are always retained.

OK, full story:

I am using an Arduino Uno, the SMD version. I wanted to be able to change the operating frequency, and therefore I used the Si5351 clock generator by Adafruit to supply the ATmega 328P a custom frequency. The problem with this clock generator is that the signal generated has a maximum voltage of 3.3V. At 16Mhz, the voltage is about 2.7. So when I tried to increase the frequency, less voltage was provided, and the LCD screen displayed some random characters(maybe from the flash). I suppose that the brown out detection reseted the system. That’s why I wanted to disable it. I have ordered a 74VHC04 inverter to buff the signal.
Now about the sketch. I didn’t want to copy paste all the sketch because first it is quite large and second it was not written by me so I don’t know if the owner wants me to share it like that. Anyway, here is a link from his website that links to the Sketch(when you click it it will download a file)( http://s.14.by/BarsStress.ino ). At the start of the Sketch there is a full description of what it does. Some weeks ago, before changing the fuses (they were: low:0xff, high:0xde, extended:0x05), the sketch was running perfectly fine up to 20Mhz, after that, it started displaying some random numbers, probably from the flash memory. Now, with these fuses(low:0xff, high:0xde, extended:0xFF), the screen doesn’t display the values for the four checks(they should be 12345678). Also, the program is uploaded through the ISP programmer. The fuses were changed with the terminal command avrdude -c usbtiny -p m328p -U efuse:w:0xFF:m. Finally, I have not burned any bootloader because I am unsure how to do so. I will be glad to give you any additional information that you may need.

Thanks for your help

The maximum frequency the microcontroller can run at is voltage-dependent. 16 MHz requires at least 3.78V power supply to be guaranteed to operate. At 2.7V, the maximum speed you are recommended to use is 10 MHz.

Stop running the chip outside of its specified limits.

the biggest problem is clearly the voltage. it is too low for the selected clock. you should lower the clock speed, or rise the voltage.

read this: » What if the supply is under 3.3V? » JeeLabs
and this: http://forum.arduino.cc/index.php?topic=4674.0

also, it is stated in the official 328p datasheet: http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Summary.pdf

Speed Grade:
– 0 - 4MHz @ 1.8 - 5.5V
– 0 - 10MHz @ 2.7 - 5.5V
– 0 - 20MHz @ 4.5 - 5.5V

When I get home I will try to run the sketch at a lower frequency. But if voltage is the problem, why did it not fail some weeks ago before changing the fuses?

Thanks for your time

Guys, sorry for reviving the post. I increased the supply voltage to 5V and the error still occurs: only the first line of the text is displayed. The second is just blank. So voltage is not the problem. Since now I have increased voltage, I don't need to disable the brown-out detection. When I tried to change back the extended fuses I get the following error(below is the full session):

User:~ Username$ avrdude -c usbtiny -p m328p -U efuse:w:0x05:m

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "0x05"
avrdude: writing efuse (1 bytes):

Writing |                                                    | 0% 0.00s ***failed;  
Writing | ################################################## | 100% 0.04s

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

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

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

avrdude: safemode: efuse changed! Was 5, and is now fd
Would you like this fuse to be changed back? [y/n] y
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 4 retries during SPI command
avrdude: 4 retries during SPI command
avrdude: 5 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 5 retries during SPI command
avrdude: 4 retries during SPI command
avrdude: 3 retries during SPI command
avrdude: 3 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 4 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 3 retries during SPI command
avrdude: 2 retries during SPI command
avrdude: 1 retries during SPI command
avrdude: 1 retries during SPI command
^C

So the error is:

avrdude: verification error, first mismatch at byte 0x0000
         0xfd != 0x05
avrdude: verification error; content mismatch

The programmer used is a cheap usbtiny. I used the same programmer to change the extended fuses to 0xFF.

I am under great time pressure. Any help is really really appreciated. Thanks.

Google it. 0xFD is the same as 0x05 because only the bottom three bits are used.
Different versions of avrdude handle the high order bits differently.
I recommend always answer n to any change it back question avrdude asks.

Thanks for replying,

I researched a bit and I encountered this website: "Reflashing Arduino Uno's Bootloader | Xuan Wu". There, it uses another Arduino as ISP and uses the command:

gdb -args avrdude -P COM_PORT -b 19200 -c stk500v1 -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m

My question is: How do I modify this command so I can use my USBtiny programmer? Thanks

Comparing that with the command line you used before, the -c option on the command line is for which programmer you are using. Notice the -U options on the end of the line. You can add those on the end of the command you used before. For example, add -U hfuse:w:0xD6:m to set the high fuse in addition to the ext fuse. -e does a chip erase. Use ext fuse value FD instead of 05 to keep from getting that error you got last time.
Online fuse calculators are interesting and handy. Like this one
http://www.engbedded.com/fusecalc

I tried changed the Extended to FD as you said successfully. The program worked exactly the same way as before: only the first line of text was displayed. Then I tried to burn the bootloader via the Arduino IDE. That worked just fine, but the program still only displays the first line. Now I will try to reset the Arduino to factory settings with this guide:

The annoying part is that I don't get any error that I can search on google...
Edit: I don't think the link I found is appropriate

I will let you know what happens.

Update:

I re-uploaded for another time the code and I finally got an error(being happy because of an error feels weird)

So the error is:

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x10
avrdude: stk500_cmd(): programmer is out of sync
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: ser_recv(): read error: Device not configured
avrdude: stk500_recv(): programmer is not responding
...
//text repeating hundreds of times 
...
avrdude: ser_recv(): read error: Device not configured
avrdude: stk500_recv(): programmer is not responding
avr_read(): error reading address 0x0000
    read operation not supported for memory "flash"
avrdude: failed to read all of flash memory, rc=-2
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: stk500_recv(): programmer is not responding
ioctl("TIOCMGET"): Device not configured
avrdude: ser_close(): can't reset attributes for device: Device not configured

From the line "read operation not supported for memory "flash"" I assume that there is something wrong with the flash memory.
The article that I found previously(Reflashing Arduino Uno's Bootloader | Xuan Wu) talks about this errors, so I will try to do the steps prescribed there.

Thank you immensely for all your help and time
I will keep you updated