Closed Hamza-arch closed 1 year ago
If you look at the Avrdude output, you can see that fuse5
is set to 0xC9. This means that the EEPROM retain fuse is already set.
(BTW you should update to the latest MegaCoreX boards manager version, which bundles Avrdude 7.0, which is way better for UPDI programming in general)
From the datasheet:
When I burn the bootloader, I got the following message. I think it is not bootloading. Can anyone guide.
Again, if you look at the Avrdude output, you can see that it's writing empty.hex
, which means that you have selected "Bootloader: Not bootloader" in the tools menu. However, if you're going to use JTAG2UPDI (or any other UPDI programmer), you don't need a bootloader. The "Burn Bootloader" button is still doing its thing though. It's setting the correct fuse bits according to your settings in the Tools menu.
avrdude: erasing chip
avrdude: reading input file "C:\Users\Muhammad Hamza\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.9/bootloaders/empty/empty.hex"
avrdude: writing flash (0 bytes):
Bottom line: The EEPROM retain fuse it set, and EEPROM should not be wiped when you upload your code. Can you confirm that the EEPROM gets erased after uploading a new program?
I understand the issue now. If I save data to EEPROM, it is saved if I turn off or on the board. However, when I upload a new program, it erases the old EEPROM data. Suppose I want to upload EEPROM vales using one progam and use it on other, is it possible??
@MCUdude You still haven't ditched the "Empty.hex" thing? I got rid of that years ago - see the boards and platform.txt for either of my cores.
If you're not using optiboot, no "bootloader" is involved. Burn bootloader is just required to set fuses (the menu option should say "Set fuses and install bootloader, if any", but the arduino team picked a phrasing that causes tons of confusion instead.
Does the new program you're uploading, say, write to the eeprom without checking that something isn't there first? Blank EEPROM cells hold the value 0xFF.
Some people have had problems with the EEPROM when it is accessed immediately after startup on megaTinyCore. Even a delay of a few milliseconds before interacting with the EEPROM made it go away, as did using brown-out detection. We speculated that slow rising power was to blame.
I understand the issue now. If I save data to EEPROM, it is saved if I turn off or on the board. However, when I upload a new program, it erases the old EEPROM data. Suppose I want to upload EEPROM vales using one progam and use it on other, is it possible??
If the EEPROM retain fuse is set, EEPROM contents will not be erased when you upload a new sketch. If your sketch change the EEPROM contents, it can be used elsewhere.
MCUdude You still haven't ditched the "Empty.hex" thing? I got rid of that years ago - see the boards and platform.txt for either of my cores.
Nope, but I probably should.
If the EEPROM retain fuse is set, EEPROM contents will not be erased when you upload a new sketch. If your sketch change the EEPROM contents, it can be used elsewhere.
Correct. I'm closing this issue because it's really not an issue
I have been trying to retain EEPROM. I am using JTAG2UPDI programmer using arduino uno. What I have understand from the documentation is that, we need to burn the bootloader once and then EEPROM gets enabled. Then we can program with programmer. Am I right?? When I burn the bootloader, I got the following message. I think it is not bootloading. Can anyone guide.