-
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
jtag2updi EEPROM write issue for AVR Dx parts in CLI mode #1128
Comments
@MCUdude
|
Updated test results from @MCUdude here. In this case, the issue with jtag2updi is the same as #1069 mentioned by @avrfreak.
|
|
From what I see, this may well be a limitation of jtag2updi. @ElTangas may further comment on this possibility. But from #1121 I think there is a way to work-around this issue (and since terminal mode works). Hopefully @stefanrueger will be able to come out similar fix for the CLI mode. |
I can reproduce the same issue. Arduino Uno clone based jtag2updi
|
I have an interesting finding, the following quick and dirty fix seems to solve the issue (not the right fix). The idea is to use byte size write for AVR Dx EEPROM in CLI mode, similar to #1121 (which is for terminal mode). For the last command, there will be some stops during the write but the end results are fine.
|
@avrfreak Edit: wrong file. Please use this latest one. |
Interestingly git main seems to work if I click the reset key of the Uno based jtag2updi programmer first before running avrdude, not very wll though. Writing will have a few pauses and can take quite long, reading will often have a few communication errors. The above patch does not seem to help in this laptop.
|
The following mod seems to work the best, usually no issues but still sometimes got pause in writing. I still need to click the reset button on the Uno before running avrdude.
|
This may be a bit better. I do not need to reset the Uno now and so far I have not got failure. I have tested on the Nano 4808 and it has no regressions for ATmega4808.
|
@stefanrueger @MCUdude @janegilruud |
@stefanrueger @mcuee @stefanrueger THX for your quick response.
Below need_progmode is used to determine if it need to leave prog mode.
In https://github.com/ElTangas/jtag2updi/blob/master/source/JTAG2.cpp
So it's clear that when the page size is not given, avrdude calls jtagmkII_write_byte, and it always fails. Unluckly .avrdx series' eeprom section don't implement page section that doesn't like other e.g. MEGA3209 does. Remove need_progmode checking will fix this issue. But I wonder why it exists and if it will bring new issues. |
Is that a real difference of dx parts to non-dx parts? Or is it an omission in avrdude.conf.in? If the former (that is the dx parts just behave differently) then I guess that the $ avrdude -p*/St | grep family_id | grep -v common informs me that .dx parts have either the 7-character ID
If the latter (dx parts really have paged memory in some sense and the size is 2) then we can change the eeprom page_size property in avrdude.conf.ing |
I asked a Microchip developer about this. On the AVR-DA it's |
@llinjupt Seeing as you have the part and the programmer, please could you create a PR that fixes the issue. Make sure that your code only changes the normal workings when Thanks for contributing. |
I am gald to but I am afraid I am going to mess it up. While searching the whole source code with keyword On the other hand, I am not sure if there is another AVR series which has no paged EEPROM as the AVR Dx does. If so, that series may have the same issue and this fix doesn't work. BTW, Interesing there was a
Why it was removed in 7.1? |
I wouldn't worry about that too much. Above comment suggests the current code base works for older parts, xmega, newer non-dx parts. Sometimes, the firmware of AVR programmers have mysterious ways of working, too. I would not touch that unless you can prove by checking all possible working parts so far that something is not necessary. I would focus on what needs doing to make programming work for DX parts. Unfortunately, I cannot translate your observations into C code as they are ambiguous to me. I simply don't know how the code would look like when you say "Remove
Avrdude 7.1 has powerful options to see how Avrdude understands part and programmer parameters
|
In jtagmkII.c, for your reference:
I am not sure if need to do the same thing in jtagmkI_write_byte() for other programmers, and thanks for other helpful info. |
@stefanrueger, see the reference above, that's my solution by removing need_progmode, but I didn't get any response. |
Well, that's how I implemented it (I think!): the difference is that I have left need_progmode for non-dx parts to avoid potential for regression. |
IMHO, parts which have page_size (> 1) never call this byte-write funciton, instead, they go jtagmkII_paged_write in which it doesn't bother need_progmode. Anyway, be careful is alway good. |
Whilst avrdude might not call this function when page_size > 1, the function is also part of libavrdude. I don't know whether anyone out there has their own application that would stop working when we remove need_progmode. Unless someone can conclusively prove that code fragment is hogwash, I tend not to remove (presumably) working code. |
Initial test shows PR #1318 is good. |
Updated:
The text was updated successfully, but these errors were encountered: