-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avrdude EEPROM read/write problem with optiboot and stk500v2 bootloader #986
Comments
I am not so sure if this EEPROM write problem is specific to my Arduino Mega2560 Clone or a generic problem. //////////////////////////////////////////////////////////////////////////////////////////////// Now the read and write seem to match. But using AVR Dragon shows that the write is not that correct.
|
Here is for Arduino Uno Clone (which follows the official design with ATmega16U2 and a DIP ATmega328P chip). I tried the original Arduino bootloader and another optiboot bootloader from @MCUdude with the same result. I tried the hex file here from @MCUdude which is supposed to work with EEPROM and it does not seem to work either. I have tried two Arduino Uno boards (one clone with ATmega16U2 and one clone with CH340).
There is no issue using an AVR Dragon.
|
As per the command here, bootloader may not work well with terminal mode. But even if I do not use the terminal mode on the Uno, it still does not work either.
Another Uno.
|
Okay, with the help here, it seems to work with the Uno using the bootloader from @WestfW.
|
Going back to Arduino Mega2560. I reflash the Mega2560-prod-firmware-2011-06-29.hex production firmware. Even if I do not use terminal mode, it does not seem to work properly with write. It does not seem to write anything for the test hex file.
|
It is said that the production hex file is buggy and I should use the other one. I still got the content missmatch failure for EEPROM write.
|
Okay, that is caused by the known issue that EEPROM read will fail. In reality the EEPROM read is good.
|
I think I can close this issue as the EEPROM read issue for the original Arduino Mega2560 is well known. I will see if I can recompile the bootloader and check again. |
Yes I can rebuild the hex file with the pull-request with WinAVR-20100110 version and it does help.
The working hex file is attached here as well for reference. |
The hex file provided by @stefanrueger works fine as well for the Arduino Mega2560 clone. |
I have not read carefully the full history of this issue, but I note that Optiboot implements a skeleton of STK500v1, so looks to work with Glad to know my bootloader works with EEPROM r/w under |
Unless you're skipping the HW support for bootloaders (ala "virtual boot partition" in Optiboot), the boot partition sizes in classic AVRs grow in powers of two, rather than "pagesize increments." So the next bootloader size up from 256 bytes is 512 bytes, and the minimum bootloader size on ATmega1280/2560 is 1k. (Not that having "extra space" in the bootloader section is all bad. this is one of the reasons that I stuck so much "useless cruft" (like the build parameters) in the Optiboot "BIGBOOT" (1k) versions - once you go even a little bit past the 512 byte mark, you have a whole additional 512 bytes to use...) The "new" avrs let you change the boot partition size in multiples of 256 (mega0, tiny0/1/2) or 512 (avr-dX) bytes. Still not "pages", but significantly more flexible than the older AVRs. |
Initially I had problems with the optiboot Mega2560 bootloader from MCUdude's Megacore, later the issue is sorted out. It also works with EEPROM read/write as well.
From @MCUdude's comments
|
Just for completeness, the hex file by stefanrueger for the ATmega328P also works fine.
|
@WestfW Correct, and that's what I do. I call these bootloaders vector bootloaders, but to all extents and purposes the idea originates from your virtual boot partition. Feel free to head over to Discussion #940, where I propose a new programmer for AVRDUDE that patches vector bootloaders so that mechanism costs zero bytes in the actual bootloader (which jumps to the agreed vector number rather than reset - both are constant). I have a draft implementation for that AVRDUDE SPM programmer (which I call Would be very interested in your comments in Discussion #940! I plan to publish the whole lot (SPM programmer for AVRDUDE, urboot bootloader and an AVR uploader sketch that deals with fuses, watchdog timeout, LED position) in the next few months once I figured out a way of integrating that with AVRDUDE so that as little as possible needs changing in the AVRDUDE code base. I predict the new SPM programmer might be useful for the optiboot project, too. My work on the Anyway, with the proposed |
I had looked at the data sheet, and I think vector bootloaders should still work (but I haven't tried yet). |
There are known problems with EEPROM and some bootloader/parts combination.
There is also a known stk500v2 bootloader (wiring bootloader) for the Arduino Mega2560 with regard to EEPROM reading. But it is said that EEPROM writing should work as per @MCUdude.
However, I can not even get the basic EEPROM writing working with either Arduino Uno (optiboot, subset of stk500v1 protocol) and Arduino Mega2560 (subset of stk500v2 protocol).
So I am wondering if this is just my issue or is a more generic issue.
The text was updated successfully, but these errors were encountered: