-
Notifications
You must be signed in to change notification settings - Fork 151
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
Always use paged access for programmers that serve bootloaders #1141
Conversation
As you mentioned and I can reporduce as well, It helps but does not 100% fix the issue EEPROM write issue for the "ATmega161 ATmega163 ATmega8515 ATmega8535". Can we carry out special treatment just for these four in stk500v1.c for bootloader of these four parts (after merging of PR #1140)? Then it should be able to fix the issue 100%. avrdude 7.0
This PR:
|
No, because optiboot wants word addresses everywhere. It is impossible to solve this for page sizes of 1! Optiboot users could create custom parts Other bootloaders that want byte addresses (eg, my |
I see. That is a good workaround. Shall we just include this in the avrdude.conf and mention this in the document?
That will be great. I am thinking we need to release avrdude 8.0 (and not planned 7.1) once that is done. |
I see. That is a good workaround. And indeed it works fine. Shall we just include this in the avrdude.conf and mention this in the document?
|
It looks like there's still issues with Atmega8535 at least:
|
With this PR I'm getting an error when writing to the Atmega4808. Since the error appears at address 0x40, maybe this is a page write issue?
|
I created a test hex file using
|
And without the PR? Have you exercised |
The problem lies squarely with optiboot. optiboot wants word addresses everywhere. It is impossible to solve this for page sizes of 1! This PR helps other bootloaders that do not use word addresses for size 1 pages (which out of necessity) will lead to a doubling of characters |
Yes, this time I made sure I ran This is the error. It complains that the device has a different value at addr 0x0040 than the input file:
However, I realize now that this PR is not causing it. I'm getting the same error when building and running git main:
|
But it works with Avrdude 6.3 (and Avrdude 7.0 actually!), even though Optiboot is the one being tricky here. |
In fairness, the problem is the protocol that arduino and optiboot use here (and it goes back to a wrong stk500v1 implementation that erroneously sent word addresses upon which optiboot followed suit). There is another trick, though, for ATmega161, ATmega8535 etc: This affects the (
That's what I thought b/c the ATmega4808 has an eeprom page size > 1 and, therefore, is unaffected by this PR. @mcuee has this neat way of finding which commit is to blame. Perhaps we get some intell about this that way? |
I do own an ATmega8535, and I've compiled Optiboot with EEPROM support for it. AFAIK EEPROM read/write has never worked for these old chips, so maybe we instead should modify the Optiboot source code? I don't know all the underlying details all that well, I'm just interested in getting Avrdude to support Optiboot as well as possible. Regarding the Atmega4808 EEPROM issue, I tracked down the issue to our usual suspect: 3d06457. |
Regarding the EEPROM write for the ATmega4808. I can confirm that PR #1140 resolved this issue! |
That's not sufficient b/c you also need to change the other side (the programmer in AVRDUDE). I have just pushed a commit to PR #1140 to try to solve this problem by pretending the classic parts with EEPROM page size 1 actually has 16 byte pages. This should(!) now work for the classic optiboot (no changes needed there). Note it's PR #1140, not this one. Pls feel free to try with ATmega8535 or ATmega161. |
Great. PR #1140 now works with the 4 classic AVR chips which has the issue. But I am not using the real chip for testing but using the ATmega328P with |
Supposed to fix Issue #970
I have made another stab at this and implemented Option 1 of #970 (comment). Now writing to EEPROM works, in principle. The chosen example of #970 is not great b/c optiboot only ever uses word addresses. With a page size of 1 (as in the EEPROM of ATmega161) this will out of necessity write to even addresses only yielding a verification error.
Reading purports a doubling of characters b/c the even addresses are all read twice:
Actually, bytes at odd addresses have never been modified:
However, this is outside the remit of this PR. Optiboot_x and optiboot_dx that use byte addresses throughout should be OK once PR #1140 is merged.