I'm using my custom Sanguino (ATMega644p) based board.
I've had some issues with loosing data stored in EEPROM due to bad power connector, however now I'm seeing much worse issues when program in Flash gets corrupted! It happens very rarely (so far I've seen it twice in 3-4 months), every time when power is interrupted (i.e. DC plug wiggled). Program is either gone or corrupted, re-flashing it back solves the problem.
I've see other people reporting this issue, and many recommend enabling Brown Out Detection (BOD).
I'm looking for a guide how to enable it on ATMega644p w/ Sanguino bootloader/hardware definition.
Guessing I need to modify boards.txt file, specifically this line:
I know about fuse calculator site (not sure exactly which values I need to choose), so using it I can change above values, but do I need burn Bootloader again in order for them to be active in the chip?
From above values, any way to tell what it's set for right now?
Anything I need to do?
I don't know about the calculator site, where is it??? That would sure be easier.
Anyway, to the best of my knowledge, yes you have to burn the boot-loader again to set the fuses. avrdude.exe should be able to tell you the current value for the fuses for a chip that doesn't have that stuff locked out.
I don't know why ArduinoISP can't burn them, does anybody else know???
afremont:
I don't know about the calculator site, where is it??? That would sure be easier.
Anyway, to the best of my knowledge, yes you have to burn the boot-loader again to set the fuses. avrdude.exe should be able to tell you the current value for the fuses for a chip that doesn't have that stuff locked out.
I don't know why ArduinoISP can't burn them, does anybody else know???
Calculator is on this site
I just figured out that typing in values manually will show which values are set, so that part is clear
So I do have to burn bootloader. That's ok, thank you! There are 3 BOD levels, which would be recommended to select? One that's set to 4.3V?
Edit: I tried 4.3V and it would reset all the time when powered by FTDI (strange, should be 5V). So I set it to 2.7V seems stable...
I would think that finding out why the BOD is failing has a bigger priority than crippling it or do you run at the 8 MHZ clock speed? That might be an issue @ .. 2.8V 2.9V and a 16 MHz clock. I regularly put code in 328's 16 MHz and 3V3 which is on the edge, some say beyond but I'd never use a controller that far out of spec.
bratan: There are 3 BOD levels, which would be recommended to select? One that's set to 4.3V?
Edit: I tried 4.3V and it would reset all the time when powered by FTDI (strange, should be 5V). So I set it to 2.7V seems stable...
4,3V BOD has troubles working against USB Pwr and is very sensible , let's say it's on the hi end, more a 4,9 than a 4,3, I had my share of trouble trying out The BOD options.
BTW if you use avr-dude it's easy to program just the fuses without changing the program flash
bratan:
I've had some issues with loosing data stored in EEPROM due to bad power connector, however now I'm seeing much worse issues when program in Flash gets corrupted! It happens very rarely (so far I've seen it twice in 3-4 months), every time when power is interrupted (i.e. DC plug wiggled). Program is either gone or corrupted, re-flashing it back solves the problem.
I've see other people reporting this issue, and many recommend enabling Brown Out Detection (BOD).
saposoft:
4,3V BOD has troubles working against USB Pwr and is very sensible , let's say it's on the hi end, more a 4,9 than a 4,3, I had my share of trouble trying out The BOD options.
BTW if you use avr-dude it's easy to program just the fuses without changing the program flash
Oh cool! Can it be done via USB? I don't have dedicated ISP, and use Arduino as ISP...
fungus:
I recommend fixing the power connector instead...
I did all I could. Using highest quality silver plated DC sockets and quality DC adapter with good plug. Issue did occur with inferior parts... That should probably reduce chances of such issue almost to 0. But enabling BOD will add another layer of protection, so I think it should be good enough
I just realized that I can just use Arduino as ISP to program Fuses
Since I created Rapid BootLoader shield, it's pretty easy to do it with that...
In case someone finds this useful:
Only the lower 3 bits are programmable in the '328P extended fuse byte.
111 = no brownout detection (0xFF, or 0x07)
110 = 1.8V (0xFE or 0x06)
101 = 2.7V (0xFD or 0x05)
100 = 4.3V (0xFC of 0x04)
Only the lower 3 bits are programmable in the '328P extended fuse byte.
111 = no brownout detection (0xFF, or 0x07)
110 = 1.8V (0xFE or 0x06)
101 = 2.7V (0xFD or 0x05)
100 = 4.3V (0xFC of 0x04)
bratan:
I just realized that I can just use Arduino as ISP to program Fuses
Since I created Rapid BootLoader shield, it's pretty easy to do it with that...
In case someone finds this useful:
I verified it works great. Just replace path to avrdude.conf and COM number to your environment
HUGE WARNING [/color]to anyone who uses above command to actually upload HEX sketch to the chip!!!!
As I just discovered it erases Bootloader! Apparently because of the "-e" switch and lack of "-D" switch.
If you interested in uploading sketch without loosing Bootloader use this command:
No this will not work correctly from ISP programming. You will see it will not work once you change your program. Try adding a line to you code and then re-upload it with that command again. It will probably not work anymore.
The flash memory cannot be programmed to back to a "1" once it is programmed to a "0" unless you erase it. The -D option only works with a bootloader because it does a page erase at a time instead to reprogram. If you reprogram via ISP then the only way is to erase all flash first.