-
Notifications
You must be signed in to change notification settings - Fork 139
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
Try to run ChipErase on UPDI even if return code is -67 #982
Conversation
More details in arduino/ArduinoCore-megaavr#33 (comment) Co-authored-by: Martino Facchin <[email protected]>
Looks good to me! This has been incorporated in the Arduino flavored Avrdude version for a couple of years now and has not caused any issues AFAIK. |
For reference, 67 is documented in pyedbglib as # avr8protocol.py
AVR8_FAILURE_CRC_FAILURE = 0x43 # CRC operation caused an error |
@umbynos slightly off-topic, but will Arduino's Avrdude fork be available on downloads.arduino.cc when you've finished working on your 7.0 fork? |
@MCUdude actually is already available on the download servers:
We still miss a test |
Thanks, @umbynos! I managed to get my boards manager file working with the links you provided. After a bit of testing, I'm a bit bummed out that your |
My |
@umbynos sorry, I take it all back! It turned out to be some flakey hardware on my side |
@dl8dtl or @mariusgreuel can we merge this as it is? |
Well, I don't particularly like those "magic numbers" – not only in the patch but also in the existing code. Apart from that, it's fine. |
@dl8dtl AFAIK the reason why the magic number 68 was used in the first place is because it's defined in jtag3_private.h, and is not available in main.c. We could either include jtag3_private.h in main.c, or add another comment. if (rc != 0) {
// -67 == -(0x47) == -(RSP3_FAIL_CRC_FAILURE)
// -68 == -(0x44) == -(RSP3_FAIL_OCD_LOCKED)
if ((rc == -67 || rc == -68) && (p->flags & AVRPART_HAS_UPDI) && (attempt < 1)) {
`` |
The we'd better not pass that number straight into main() anyway. Yes, it's a bit more of work, but a lot cleaner then. |
I'm not sure I follow you... Which public header; jtag.h? |
libavrdude.h ought to document everything that is needed to describe the API to the underlying functions. |
https://github.com/dl8dtl/avrdude/tree/jtag3_retcode That's my proposal. I can turn that into a PR if there's interest, but I don't think it makes sense to try merging it with the current PR. |
@dl8dtl even though I haven't tested your code, I agree that the idea is good. The code looks fine as well 🙂 |
@dl8dtl would be great if you could submit your work as a PR 👍 |
Replace internal knowledge in jtag3.c by a public API Supersedes #982
Superseded by #996 |
More details in arduino/ArduinoCore-megaavr#33 (comment)
Co-authored-by: Martino Facchin [email protected]
Related conversation with @MCUdude umbynos@b6d21d1#commitcomment-73387352