Skip to content
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

Force STK500 EEPROM paged r/w for bootloaders #1602

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

stefanrueger
Copy link
Collaborator

Fixes failing terminal r/w of UPDI EEPROM for -c arduino and -c urclock. See discussion

@stefanrueger
Copy link
Collaborator Author

Tests should check -U EEPROM r/w and terminal EEPROM r/w for UPDI parts with bootloaders, eg, optiboot_x. In absence of keep alive for -c arduino the command line terminal options, eg, -T dump eeprom can be used for testing.

@mcuee mcuee added the bug Something isn't working label Dec 26, 2023
@MCUdude
Copy link
Collaborator

MCUdude commented Dec 26, 2023

I can't say I'm having any issues with optiboot_x (from the MegaCoreX repo) when using git main and -carduino:

$ ./avrdude -carduino -patmega4808 -P ch340 -T 'read eeprom'
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9650 (probably m4808)

avrdude: processing -T read eeprom
Reading | ################################################## | 100% 0.05 s 
0000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0050  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0060  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0090  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00d0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00e0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude done.  Thank you.

$ ./avrdude -carduino -patmega4808 -P ch340 -T 'write eeprom 0 0x11223344'
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9650 (probably m4808)

avrdude: processing -T write eeprom 0 0x11223344
Caching | ################################################## | 100% 0.01 s 
avrdude: synching cache to device ... 
Writing | ################################################## | 100% 0.03 s 

avrdude done.  Thank you.

$ ./avrdude -carduino -patmega4808 -P ch340 -T 'read eeprom'
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9650 (probably m4808)

avrdude: processing -T read eeprom
Reading | ################################################## | 100% 0.05 s 
0000  44 33 22 11 ff ff ff ff  ff ff ff ff ff ff ff ff  |D3".............|
0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0050  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0060  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0090  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00d0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00e0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude done.  Thank you.

@mcuee
Copy link
Collaborator

mcuee commented Dec 27, 2023

Interesting that @MCUdude has different test results compared to @askn37 for optiboot_x.

Let me check as well later with both optiboot_x and optiboot_dx.

@askn37
Copy link
Contributor

askn37 commented Dec 27, 2023

@mcuee

With the combination of optiboot_x + -c arduino + -p atmega4808, EEPROM becomes page_size=64, so there is no problem reading and writing EEPROM in interactive mode even without this patch.

The purpose of this patch is to improve the "page_size=1" part. Currently this applies to Dx AT pack products.

Please note that official Optiboot only supports up to "optiboot_x", i.e. NVMCTRL version 0. (Subsequent new product support proposals were rejected. Based on AT pack classification, only Mega/Tiny AT packs are supported)

@mcuee
Copy link
Collaborator

mcuee commented Dec 27, 2023

@askn37

Optiboot_dx supports AVR DA/DB/DD family. That is what we tested within avrdude project.
https://github.com/SpenceKonde/DxCore/tree/master/megaavr/bootloaders/optiboot_dx

For optiboot_x, the following two implementations are tested within avdude project.
https://github.com/MCUdude/MegaCoreX/tree/master/megaavr/bootloaders/optiboot (megaAVR-0)
https://github.com/SpenceKonde/megaTinyCore/tree/master/megaavr/bootloaders/optiboot_x (tinyAVR 0/1/2)

If your implementation deviates from the above, then you may have to come out with patches which do not break the existing implementations.

@askn37
Copy link
Contributor

askn37 commented Dec 27, 2023

@mcuee

Of course I know. I've been keeping an eye on all its variants (forked from Optiboot) and doing comparative testing as well.

Additionally, I may be able to add an "unnamed" STK500 v1 compatible boot that I maintain to that list...

All NVMCTRL version 0 products (for Mega/Tiny AT pack)
https://github.com/askn37/multix-zinnia-sdk-megaAVR/tree/main/bootloaders/boot_ax

All NVMCTRL version 2 and 4 products (for Dx AT pack)
https://github.com/askn37/multix-zinnia-sdk-modernAVR/tree/main/bootloaders/boot_dx

All NVMCTRL version 3 and 5 products (for Ex AT pack)
https://github.com/askn37/multix-zinnia-sdk-modernAVR/tree/main/bootloaders/boot_ex

FLASH/EEPROM rewrite functionality is no different from other variants. It maintains complete upward compatibility and has been tested as much as possible with "AVRDUDE 6.3 - 7.3 (main)".

The difference from other variants is that multiple chips with different signatures are shared in one binary, all binaries are EEPROM writable, changeable to hardware level RS485 and single wire serial, APPCODE There is an update snippet and CRCSCAN is supported.

I'm also working on starting a minimal protocol for 1/2 wire communication using hardware auto-baud (similar to UPDI), but it's not related to AVRDUDE or urboot yet.

@mcuee
Copy link
Collaborator

mcuee commented Dec 27, 2023

@askn37
Copy link
Contributor

askn37 commented Dec 27, 2023

@mcuee

Thanks for pointing me to the old link.

Please excuse me, but let me summarize some of the main points of writing boot code with the PM_UPDI chip.

Regarding the 64KiB/128KiB difference for the AVR_DA/DB family, we can infer that the current Intel-HEX output by avrdude tells it to generate only one STK_UNIVERSAL+PAR_LOAD_EXT_ADDR packet at the 64KiB boundary. There is no problem if you just load it into RAMPZ (for ELPM/SPM) and start it. Older boots that increment the page pointer on their own will now overwrite the pointer correctly. And on chips less than 64KiB he doesn't have RAMPZ, but even if you write to a reserved IO register it will always be interpreted as zero and ignored. (i.e. 128KiB boot code will also boot his 32KiB/64KiB)

:20FFE0007220746865206C617A7920646F672E0A54686520717569636B2062726F776E20F6 // 0ffe0> r_the_lazy_dog..The_quick_brown_
:020000040001F9
:20000000666F78206A756D7073206F76657220746865206C617A7920646F672E0A54686574 // 10000> fox_jumps_over_the_lazy_dog..

On the other hand, the boot method of switching his PGMEM bank with his FLMAP (LD/ST only) in NVMCTRL_CTRLB is harmful (silicon errata) at least for AVR128DA. There are few benefits to using FLMAP other than being able to code only in C/C++. The ELPM/SPM method is linear up to 64KiB.

tiny/megaAVR does not have ELPM/SPM. Write the flash using normal LD/ST. So boot code has a habit of adding MAPPED_PROGMEM_START = 0x4000/mega or 0x8000/tiny to pointers since the PP/SPI/PDI days. (This practice still exists today in the form of adding MAPPED_EEPROM_START to EEPROM)
Conversely, chips with ELPM/SPM expect a set of 24-bit MSBs to distinguish them from LD/ST for EEPROM. (ATDF<property name="PROGMEM_OFFSET" value="0x00800000"/>) The MAPPED_PROGMEM_START offset is generally not used to avoid overflow.

The 24bit MSB is important in UPDI, but is ignored when writing to RAMPZ within BOOTAPP. Other than the LSB, it is always fixed at zero, so there is no harm done.

@mcuee
Copy link
Collaborator

mcuee commented Dec 27, 2023

@askn37

Just want to summarize your findings in Discussion #1473:

  1. no issues with MegaCoreX -- eg, no problem with ATmega4808 and ATmega4809
  2. issues with optiboot_dx with AVR DA chip, probably also DB/DD/EA chips, with either -c arduino and -c urclock.

Please confirm that my understandings are correct.

And based on your tests with AVR32DA32, this PR #1602 fixed the issue above issue with optiboot_dx.

@mcuee
Copy link
Collaborator

mcuee commented Dec 27, 2023

I can confirm that there is no issue with git main for ATmega4808/4809 using optiboox_x from MegaCore.

I will test with optiboot_dx later.

Example for Arduino Nano Every (using ATmega4809).

C:\work\avr\avrdude_test\avrdude_bin> cat entest1.hex
:020000040000FA
:2000000054686520717569636B2062726F776E20666F78206A756D7073206F76657220740E
:200020006865206C617A7920646F670A54686520717569636B2062726F776E20666F78207C
:200040006A756D7073206F76657220746865206C617A7920646F670A5468652071756963FD
:200060006B2062726F776E20666F78206A756D7073206F76657220746865206C617A7920D4
:20008000646F670A54686520717569636B2062726F776E20666F78206A756D7073206F76B5
:2000A000657220746865206C617A7920646F670A54686520717569636B2062726F776E20FE
:2000C000666F78206A756D7073206F76657220746865206C617A7920646F670A54686520C2
:2000E000717569636B2062726F776E20666F78206A756D7073206F76657220746865206C16
:00000001FF

C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c arduino -P COM8 -p m4809 -U eeprom:w:entest1.hex
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9651 (probably m4809)

avrdude: processing -U eeprom:w:entest1.hex:i
avrdude: reading input file entest1.hex for eeprom
         with 256 bytes in 1 section within [0, 0xff]
         using 4 pages and 0 pad bytes
avrdude: writing 256 bytes eeprom ...
Writing | ################################################## | 100% 0.07 s
avrdude: 256 bytes of eeprom written
avrdude: verifying eeprom memory against entest1.hex
Reading | ################################################## | 100% 0.05 s
avrdude: 256 bytes of eeprom verified

avrdude done.  Thank you.

C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c jtag2updi -P COM8 -p m4809 -T "read eeprom" -r
avrdude: touching serial port COM8 at 1200 baud
avrdude: waiting for new port... using same port COM8
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9651 (probably m4809)

avrdude: processing -T read eeprom
Reading | ################################################## | 100% 0.37 s
0000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0010  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0020  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
0030  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
0040  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
0050  61 7a 79 20 64 6f 67 0a  54 68 65 20 71 75 69 63  |azy dog The quic|
0060  6b 20 62 72 6f 77 6e 20  66 6f 78 20 6a 75 6d 70  |k brown fox jump|
0070  73 20 6f 76 65 72 20 74  68 65 20 6c 61 7a 79 20  |s over the lazy |
0080  64 6f 67 0a 54 68 65 20  71 75 69 63 6b 20 62 72  |dog The quick br|
0090  6f 77 6e 20 66 6f 78 20  6a 75 6d 70 73 20 6f 76  |own fox jumps ov|
00a0  65 72 20 74 68 65 20 6c  61 7a 79 20 64 6f 67 0a  |er the lazy dog |
00b0  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
00c0  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
00d0  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
00e0  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
00f0  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|

avrdude done.  Thank you.

@mcuee
Copy link
Collaborator

mcuee commented Dec 27, 2023

I can confirm that there is no issue with git main for ATmega4808/4809 using optiboox_x from MegaCore.

Example for Arduino Nano Every (using ATmega4809).

No regression from this PR either.

PS> .\avrdude_pr1602 -C .\avrdude_pr1602.conf -c arduino -P COM8 -p m4809 -T 'erase eeprom'
avrdude_pr1602: AVR device initialized and ready to accept instructions
avrdude_pr1602: device signature = 0x1e9651 (probably m4809)

avrdude_pr1602: processing -T erase eeprom
Caching | ################################################## | 100% 0.34 s
avrdude_pr1602: synching cache to device ... done

avrdude_pr1602 done.  Thank you.

PS> .\avrdude -c jtag2updi -P COM8 -p m4809 -T "read eeprom" -r
avrdude: touching serial port COM8 at 1200 baud
avrdude: waiting for new port... using same port COM8
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9651 (probably m4809)

avrdude: processing -T read eeprom
Reading | ################################################## | 100% 0.37 s
0000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0050  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0060  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0090  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00b0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00d0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00e0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude done.  Thank you.

PS> .\avrdude_pr1602 -C .\avrdude_pr1602.conf -c arduino -P COM8 -p m4809 -U eeprom:w:entest1.hex
avrdude_pr1602: AVR device initialized and ready to accept instructions
avrdude_pr1602: device signature = 0x1e9651 (probably m4809)

avrdude_pr1602: processing -U eeprom:w:entest1.hex:i
avrdude_pr1602: reading input file entest1.hex for eeprom
                with 256 bytes in 1 section within [0, 0xff]
                using 4 pages and 0 pad bytes
avrdude_pr1602: writing 256 bytes eeprom ...
Writing | ################################################## | 100% 0.07 s
avrdude_pr1602: 256 bytes of eeprom written
avrdude_pr1602: verifying eeprom memory against entest1.hex
Reading | ################################################## | 100% 0.05 s
avrdude_pr1602: 256 bytes of eeprom verified

avrdude_pr1602 done.  Thank you.

PS> .\avrdude -c jtag2updi -P COM8 -p m4809 -T "read eeprom" -r
avrdude: touching serial port COM8 at 1200 baud
avrdude: waiting for new port... using same port COM8
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9651 (probably m4809)

avrdude: processing -T read eeprom
Reading | ################################################## | 100% 0.37 s
0000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0010  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0020  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
0030  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
0040  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|
0050  61 7a 79 20 64 6f 67 0a  54 68 65 20 71 75 69 63  |azy dog The quic|
0060  6b 20 62 72 6f 77 6e 20  66 6f 78 20 6a 75 6d 70  |k brown fox jump|
0070  73 20 6f 76 65 72 20 74  68 65 20 6c 61 7a 79 20  |s over the lazy |
0080  64 6f 67 0a 54 68 65 20  71 75 69 63 6b 20 62 72  |dog The quick br|
0090  6f 77 6e 20 66 6f 78 20  6a 75 6d 70 73 20 6f 76  |own fox jumps ov|
00a0  65 72 20 74 68 65 20 6c  61 7a 79 20 64 6f 67 0a  |er the lazy dog |
00b0  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
00c0  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
00d0  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
00e0  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 6f 78 20  |quick brown fox |
00f0  6a 75 6d 70 73 20 6f 76  65 72 20 74 68 65 20 6c  |jumps over the l|

avrdude done.  Thank you.

@askn37
Copy link
Contributor

askn37 commented Dec 27, 2023

The problem of not being able to write to EEPROM in Arduino Nano Every + interactive mode can be resolved by applying the following patch to jtagmkII_paged_write.

jtagmkII_write_byte has traditionally used MTYPE_EEPROM_XMEGA, so this change is unlikely to break compatibility with other uses.

diff --git a/src/jtagmkII.c b/src/jtagmkII.c
index 0cadeba7..0afb50e0 100644
--- a/src/jtagmkII.c
+++ b/src/jtagmkII.c
@@ -1929,7 +1929,7 @@ static int jtagmkII_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const A
       free(cmd);
       return n_bytes;
     }
-    cmd[1] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_EEPROM: MTYPE_EEPROM_PAGE;
+    cmd[1] = p->prog_modes & (PM_PDI | PM_UPDI)? MTYPE_EEPROM_XMEGA: MTYPE_EEPROM_PAGE;
     PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
   } else if (mem_is_userrow(m)) {
     cmd[1] = MTYPE_USERSIG;
bash-3.2$ ./build_darwin/src/avrdude -r -v -p atmega4809 -c jtag2updi -P /dev/cu.usbmodem2301 -qT "dump eeprom 0 32" -T "erase eeprom" -T "write eeprom 0 \"testtest\"" -T "dump eeprom 0 32"

avrdude: Version 7.2-20231227 (d904dd10)
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is /Users/askn/Collaborator/avrdude_issue1600/build_darwin/src/avrdude.conf
         User configuration file is /Users/askn/.avrduderc

avrdude: touching serial port /dev/cu.usbmodem2301 at 1200 baud
avrdude: waiting for new port... using same port /dev/cu.usbmodem2301
         Using port            : /dev/cu.usbmodem2301
         Using programmer      : jtag2updi
         Programmer baud rate  : 115200
         AVR Part              : ATmega4809
         Programming modes     : UPDI, SPM
         Programmer Type       : JTAGMKII_UPDI
         Description           : JTAGv2 to UPDI bridge
         Main MCU HW version   : 1
         Main MCU FW version   : 1.07
         Sec. MCU HW version   : 1
         Sec. MCU FW version   : 6.07
         Serial number         : 00:00:00:00:00:00
avrdude: silicon revision: 0.1
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9651 (probably m4809)

avrdude: processing -T dump eeprom 0 32
0000  74 ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |t...............|
0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude: processing -T erase eeprom

avrdude: processing -T write eeprom 0 "testtest"

avrdude: processing -T dump eeprom 0 32
0000  74 65 73 74 74 65 73 74  00 ff ff ff ff ff ff ff  |testtest........|
0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
avrdude: synching cache to device ... done

avrdude done.  Thank you.
bash-3.2$ ./build_darwin/src/avrdude -r -v -p atmega4809 -c jtag2updi -P /dev/cu.usbmodem2301 -qT "dump eeprom 0 32"

avrdude: Version 7.2-20231227 (d904dd10)
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is /Users/askn/Collaborator/avrdude_issue1600/build_darwin/src/avrdude.conf
         User configuration file is /Users/askn/.avrduderc

avrdude: touching serial port /dev/cu.usbmodem2301 at 1200 baud
avrdude: waiting for new port... using same port /dev/cu.usbmodem2301
         Using port            : /dev/cu.usbmodem2301
         Using programmer      : jtag2updi
         Programmer baud rate  : 115200
         AVR Part              : ATmega4809
         Programming modes     : UPDI, SPM
         Programmer Type       : JTAGMKII_UPDI
         Description           : JTAGv2 to UPDI bridge
         Main MCU HW version   : 1
         Main MCU FW version   : 1.07
         Sec. MCU HW version   : 1
         Sec. MCU FW version   : 6.07
         Serial number         : 00:00:00:00:00:00
avrdude: silicon revision: 0.1
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9651 (probably m4809)

avrdude: processing -T dump eeprom 0 32
0000  74 65 73 74 74 65 73 74  00 ff ff ff ff ff ff ff  |testtest........|
0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude done.  Thank you.

@stefanrueger
Copy link
Collaborator Author

The problem of not being able to write to EEPROM in Arduino Nano Every + interactive mode can be resolved by applying the following patch to jtagmkII_paged_write.

Thanks for this patch @askn37! Please could you submit an independent PR, so the team can test whether this change results in a regression for other programmers.

@stefanrueger stefanrueger merged commit d11e2f6 into avrdudes:main Jan 3, 2024
@stefanrueger stefanrueger deleted the eeprom-optiboot-updi branch January 3, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants