-
Notifications
You must be signed in to change notification settings - Fork 137
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
Fix jtag3_page_erase for targets with UPDI #1112
Conversation
Very handy to have now that avrdudes#1106 is merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coding looks good. If XMEGA page erase still works and UPDI parts can now have pages erased that is great.
I would double check XMEGA apptable page erase (both in theory and testing in practice). I suspect the routine fails to treat apptable
correctly (and if so this would have been wrong before), but maybe it does treat it correctly.
Perhaps line 1703 might be changed from if (strcmp(m->desc, "flash") == 0)
to sth like if(avr_mem_is_flash_type(m->desc))
instead; then also the else if (strcmp(m->desc, "boot") == 0)
branch can go. My suggestion may still be not sufficient in case that apptable
has yet a different XMEGA_ERASE_APPTABLE_PAGE command (I don't know!)
And what about eeprom page erases? Would this PR do them correctly for UPDI parts? |
Thanks! Xmega page erase (still) works fine.
Thanks for the tip! I'll do it this way, and check if I can get apptable page erase working as well.
Yes, for AVRs with UPDI that have an EEPROM page defined (like ATmega4808). When trying to EEPROM page an AVR Dx, it only erases one byte; the address passed to |
Sorry, but I've not been able to page-erase the app table memory on my ATxmega128A3U using a Power Debugger. I'm not sure it's even possible. I've tried many different commands (XMEGA_ERASE_APP_PAGE, XMEGA_ERASE_BOOT_PAGE, XMEGA_ERASE_EEPROM_PAGE, XMEGA_ERASE_USERSIG), but nothing works. |
Is it possible to erase an apptable page by erasing flash at apptable_offset + apptable_address? |
Sorry, I tried a bunch of different combinations but was not able to page erase the app table. I can probably contact Microchip and check if the Xmega and/or JTAG3 programmer supports this. |
@MCUdude Ref: |
@MCUdude Here my understanding (might well be wrong): The |
Tested with ATtiny817 Xplained Mini and this PR works fine.
|
I think this can be merged and then you can add the Ref: |
@stefanrueger I'm for some reason suddenly having a hard time writing to apptable...
|
By right you need to use hidapi under macOS and can not fall back to libusb. You may have to rebuild avrdude. |
I believe I'm building with hidapi:
I'm also able to read and write to flash in terminal mode just fine |
That is good to know. Then the error message is strange. It seems to fail to use hidapi and fall back to libusb in your first result and then the error message will appear.
Do you still see the error message some times when using the terminal mode? It is kind of strange. |
Nope, I didn't see it until I started messing with the apptable memory. Everything else works flawlessly. |
Not so sure if the xmega issue is only specific to jtag3 or not, my AVRISP mkii clone seems to be okay.
|
@MCUdude and @stefanrueger |
Might that also be a workflow/make (missing make clean) issue? Let's check again when all the PRs are integrated in the next few days. |
Very handy now that #1106 is merged.
Tested and proved to work with an ATmega4808 and an ATxmega128A3U using a Power Debugger, and an AVR128DB48 using a pkobn_updi (Curiosity Nano board).
Here are some reference benchmarks.
Commands:
Without jtag3 UPDI page erase fix
With jtag3 UPDI page erase fix