-
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
Use byte-wise read/write when page size is 1 in terminal cache #1121
Conversation
I think the pull request is correct but it does not sort out the wrong warning message issue as in #1116.
|
My Arduino Nano Every with ATmega4809 has issues with EEPROM writing. This PR does not change the behavior.
|
@stefanrueger avrdude 7.0 release -- not able to read EEPROM
|
Given that jtag2updi has specific problems when programming eeprom in avrdx, and various other issues, I have given up on jtag2updi. I purchased a PG164100 (SNAP) debugger for just $34 USD. I use it as a UPDI programmer with avrdude. There is one problem that is Avrdude related (nothing to do with the SNAP Programmer). |
No problem. It seems to me jtag2updi is less popular now and searialupdi may gain popularity.
Yes I will agree that SNAP or PICKit 4 is the way to go for the future if you want the best compatibility with future AVR pars (as well as PICs). I actually bought an SNAP as well but i have not used much yet.
Please help to create nother issue to see if this can be fixed. Thanks. |
Here it is: |
The problem here is that
@mcuee Please feel free to test --- I hope it works now with your programmer. |
Yes it is good now. No problem with the error message as it is the limitation of the onboard jtag2updi FW.
|
@stefanrueger
|
As for the optiboot_dx bootloader, it is the same behavior but I think that bootloader is anyway not working for EEPROM so you can ignore it.
|
Here are the results of my tests with this PR. There are so many logs I decided to just write down the end result instead. Note that the JTAG2UPDI will time out in terminal mode if not built with
I'll provide test results for optiboot_x and optiboot_dx a little later and edit this post.
|
(Avrdude, git main)
Here's what the duplicate data for the ATmega4808 looks like:
Here's what the duplicate data for the AVR128DA32 looks like:
However, these are the results I'm getting for AVR128DA32 when using Avrdude 6.3 and the avrdude.conf file shipped with DxCore:
|
@MCUdude Cool testing and very clear tables. Identifies where the current code base has weaknesses. Really useful. Will have a look later (will be a few days, though). Note that this PR #1121 and the previous related one #1106 only concern themselves with terminal mode, and address that terminal mode rarely worked for flash writes (see underlying Issue #1020). |
@MCUdude Can you redo the test with |
I'm pretty sure I did all the tests with this PR, and my stating that I used git main was incorrect. I'll have to double-check when I'm home. |
I see. I also felt strange that you tested with git main. |
Summary of my test results, using optiboot_dx and AVR128DB48.
git main terminal mode read problem -- read duplicate.
|
Damnit, I pulled this PR, but I forgot to |
@MCUdude I don't think you need to re-run the tests. This PR will not have changed what
The problem with optiboot-x and -dx is that |
@MCUdude |
@stefanrueger |
Just wondering if you can create a PR to deal with the above two situations for the My Arduino Nano Every can not write EEPROM using Ref: arduino/ArduinoCore-megaavr#120
|
I can confirm that this PR resolves issue #1120 (JTAG2UPDI + ATmega4808 and SerialUPDI + ATmega4808), but it does not resolve the issue with AVR-Dx'es, see error below. In other words, my "test tables" with this PR looks like this:
|
Since this PR deals with #1116 (terminal mode), so it is okay even with AVR128DA32. Therefore it is good to go. The
|
This PR also helps optiboot (with bigboot EEPROM support) for classic AVRs. Please refer to the test results in #1129. |
Thanks for comments and tests in this PR and all other open PRs, in particular, @mcuee and @MCUdude. I think I will merge all recent PRs and we take it from there to fix further error messages and look at which My medium-term plans are to finally integrate my own programmer |
That will be great. After that, maybe a new avrdude release is good to have. |
By the way, I build a jtag2updi using the Arduino Uno clone, and now it seems to perform better without the error messages compared to my Nano 4808 on-board jtag2updi.
However, Edit: I think it is probably due to the fast time out.
I have to use the trick from @MCUdude mentioned below and it works fine now. No more strange error messages.
|
The firmware running on the 4809 Nano Every and 4808 "Nano Every" is, IIRC, quite old, and there have been numerous bug fixes to the jtag2updi project since. |
@MCUdude Unfortunately I do not see that UPDI pin exposed by Arduino for the official Nano Every board (ATmega4809) based on the schematics. It does support FW upgrade but the FW is rather old. |
@mcuee the Nano 4808 doesn not have public schematics as far as I know. However, there is som information here: https://www.avrfreaks.net/forum/nano-every-use-atmega4808 The chip that handles jtag2updi has been identified to be a Nuvoton N76E003AQ20. I'm not sure how it can be upgraded. The ported jtag2updi program is also not public. |
I see. No point trying to figure out how to fix the on-board jtag2updi programmer in this case. Anyway, it has the updi pin available and I can use the Uno based jtag2updi to program the ATmega4808. I have quite some Uno clones anyway (they are pretty cheap). Next step is to build a serialjtag programmer from USB to TTL converter. I have less USB to TTL converters but they are even cheaper than the Uno clones. |
Hi All, I don't think this patch would fix avrdx serials EEPROM writing issue. When the eeprom page size is 1, avrdude calls jtagmkII_byte_write instead of jtagmkII_paged_write to handle EEPROM writing. To my surprise there is a variable named need_progmode in jtagmkII_write_byte and when it's flash or eeprom this vairable will be set as 0 and jtagmkII_program_disable will be called. But in jtagmkII_paged_write, it always leave progmode enabled. After checking jtag2updi code, I learned that it always check if it is progmode before writing. So I tried to add page_size for AVR128DA48 in avrdude.conf to make avrdude call jtagmkII_paged_write and it worked.
and it went well:
I wonder why need to quit progmode in jtagmkII_write_byte. And I hope this info helps. |
| I don't think this patch would fix avrdx serials EEPROM writing issue. @llinjupt Correct. This PR only deals with the terminal mode ( Thanks for commenting and for your insights. Given the 20 year-old history of AVRDUDE, support for new AVR parts, new programming interfaces, and new physical programmers have been added sometimes in a haphazard way. The idea is that avrdude.conf describes the part with needed parameters as close as possible to the data sheet and that the code base then relies on part properties. Sometimes changing avrdude.conf brings about the desired change for a particular problem, but that is not a good idea if that entry is incompatible with data sheets. Also, changing avrdude.conf may spell disaster elsewhere where another part of the code relies on the previous avrdude.conf entry. Perhaps best to change the code base to make the functions work correctly. Sooo, could I invite you to specify the observed wrong behaviour, create an issue if necessary, add to the issue, and keep exploring the code. It may well be that jtagmkII_write_byte does not work for the dx class of parts. Think about which parts are affected, how jtagmkII_write_byte() could detect it deals with these (perhaps by checking part->prog_mode & PM_UPDI?) and then figure out how to change the code to correctly read/write EEPROM? If you have the programmers and parts, your input would be very welcome. |
Supposed to fix Issue #1116