Using JTAG2UPDI

Hi,

In my quest for faster code uploads to AVR4809, today I explored using an Arduino Uno and JTAG2UPDI to create an UPDI programmer. It seemed to work quite well in the Arduino IDE. So I thought I’d give it a try in Platformio, but then whilst exploring the use of JTAG2UPDI in PIO, I found this.

I followed the link to an issue posted on github, but it’s unclear if the issue is resolved.

Anyone know if I can successfully configure pio to use JTAG2UPDI ?

thanks.

I tried an upload using this excerpt from pio.ini

[env:Upload_UPDI]
; Upload protocol for UPDI upload

upload_flags =
    -C
    $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
    -p
    $BOARD_MCU
    -c
    jtag2updi
    -P
	COM24
    -b
	115200
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

but although the code uploads, it doesn’t run.

The upload is very fast at 6 seconds, compared to pymcuprog which takes about 27 seconds.

Is the fix required to solve this likely to be any priority for the PIO team?

For the meantime, I’m back in the Arduino IDE if I want to upload code.
thanks.

1 Like

Oh I totally remember doing something similiar for platform-atmelavr.

If you want to try out a fix locally, you could go to your local C:\Users\<user>\.platformio\platforms\atmelmegaavr\builder\main.py

and change this block

to

    ElfToHex=Builder(
        action=env.VerboseAction(" ".join([
            "$OBJCOPY",
            "--change-addresses",
            "0x200",
            "-O",
            "ihex",
            "-R",
            ".eeprom",
            "$SOURCES",
            "$TARGET"
        ]), "Building $TARGET"),
        suffix=".hex"
    )

Actually that may be BS in this case, did you try the modification I originally wrote?

Hi, as far as I am aware the issue has not been resolved.

If you look through my original postings I have detailed a work around, which means you can upload and run via UPDI, but you don’t have the full flexibility you should have.

One thing to note though is that if you set the fuses correctly you can configure it to use a “normal” FTDI which allows you to program but also serial monitor and debug a lot easier.

Thanks for replies, is using the ftdi solution easier than what Max is suggesting? I use FTDIs with my 4809s to do the serial comms.
Might you have any further info on what needs to be done ?

edit

thanks, but on reflection, I think what you’ve described is what I was doing via FTDI and a set up as diagrammatically described in Pyupdi here which became deprecated. I then progressed to Pymcuprog, but find that slow.

end edit