If I select:
Board: AT mega4809
Pin out: Nano Every
No boot-loader
Programmer: Atmel mEDGB
It works as expected and uploads to the Nano Every without a problem.
If I change the pin out to: 48 pin standard then the upload fails with:
avrdude: Version 6.3-20201216
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\Perry Bebbington\AppData\Local\Arduino15\packages\MegaCoreX\hardware\megaavr\1.0.10/avrdude.conf"
Using Port : usb
Using Programmer : xplainedmini_updi
avrdude: usbhid_open(): No device found
avrdude: jtag3_open_common(): Did not find any device matching VID 0x03eb and PID list: 0x2145
avrdude done. Thank you.
An error occurred while uploading the sketch
I don't understand why it fails. A Nano Every has a 4809 on it. Whether I select Nano Every or 48 pin standard the programmer is the same, the target chip is the same.
My expectation was that it would work but the pin mappings would be wrong and I'd be able to use pins that were not actually connected to anything.
Why does it fail?
What do I not understand properly?
When you select an option OTHER than "Nano Every", there seem to be some "interesting" side-effects.
It will automatically select the Jtag2updi "programmer type." (when the pinout is set to "standard", it uses the programmer set in the IDE "programmer" menu. Yours seems to be set to mEDBG, which is NOT the correct programmer type for a Nano Every.)
It will use the "set speed to 1200" auto-reset technique that is unique to Arduino.
The avrdude command generated will be somewhat different, even if you have your programmer type set to "jtag2updi." For example, even though it uses a serial port, it doesn't specify a bitrate!
There may be something else going on behind-the-scenes. I can't get the every to upload using "standard" pinout, either. Even with the programmer set correctly. I can't even get it to upload using the command that is generated when the pinout is set to "Nano Every", pasted into a shell. (Maybe something WRT DTR?) Even fiddling with the reset button.
For reference Arduino IDE 1.8.13, megaCoreX 1.0.10.
Upload with pinout=Every (from within Arduino IDE):
Global variables use 171 bytes (2%) of dynamic memory, leaving 5973 bytes for local variables. Maximum is 6144 bytes.
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem147121
/Applications/Arduino-1.8.13.app/Contents/Java/portable/packages/arduino/tools/avrdude/6.3.0-arduino18/bin/avrdude -C/Applications/Arduino-1.8.13.app/Contents/Java/portable/packages/MegaCoreX/hardware/megaavr/1.0.10/avrdude.conf -v -patmega4809 -cjtag2updi -P/dev/cu.usbmodem147121 -e -Uflash:w:/tmp/Arduino1.8.13Build/test_malloc.ino.hex:i -Ufuse0:w:0x00:m -Ufuse1:w:0x54:m -Ufuse2:w:0x01:m -Ufuse4:w:0x00:m -Ufuse5:w:0b11001001:m -Ufuse6:w:0x06:m -Ufuse7:w:0x00:m -Ufuse8:w:0x00:m -Ulock:w:0xC5:m
avrdude: Version 6.3-20201216
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Applications/Arduino-1.8.13.app/Contents/Java/portable/packages/MegaCoreX/hardware/megaavr/1.0.10/avrdude.conf"
User configuration file is "/Volumes/MacOS/HD-Users/BillW/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/cu.usbmodem147121
Using Programmer : jtag2updi
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
boot-loader FW version: 1
firmware version: 1.07
hardware version: 1
S_MCU:
boot-loader FW version: 1
firmware version: 6.07
hardware version: 1
Serial number: 00:00:00:00:00:00
Device ID: JTAGICE mkII
AVR Part : ATmega4809
Chip Erase delay : 0 us
PAGEL : P00
BS2 : P00
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 0
StabDelay : 0
CmdexeDelay : 0
SyncLoops : 0
ByteDelay : 0
PollIndex : 0
PollValue : 0x00
Memory Detail :
[goes on to upload successfully]
Upload attempt with pinout=48pin standard (no other changes.)
Global variables use 171 bytes (2%) of dynamic memory, leaving 5973 bytes for local variables. Maximum is 6144 bytes.
/Applications/Arduino-1.8.13.app/Contents/Java/portable/packages/arduino/tools/avrdude/6.3.0-arduino18/bin/avrdude -C/Applications/Arduino-1.8.13.app/Contents/Java/portable/packages/MegaCoreX/hardware/megaavr/1.0.10/avrdude.conf -v -patmega4809 -cjtag2updi -P/dev/cu.usbmodem147121 -Uflash:w:/tmp/Arduino1.8.13Build/test_malloc.ino.with_bootloader.hex:i -Ufuse0:w:0x00:m -Ufuse1:w:0x54:m -Ufuse2:w:0x01:m -Ufuse4:w:0x00:m -Ufuse5:w:0b11001001:m -Ufuse6:w:0x06:m -Ufuse7:w:0x00:m -Ufuse8:w:0x00:m -Ulock:w:0xC5:m
avrdude: Version 6.3-20201216
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Applications/Arduino-1.8.13.app/Contents/Java/portable/packages/MegaCoreX/hardware/megaavr/1.0.10/avrdude.conf"
User configuration file is "/Volumes/MacOS/HD-Users/BillW/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/cu.usbmodem147121
Using Programmer : jtag2updi
avrdude: jtagmkII_getsync(): sign-on command: status -1
I was typing on my phone yesterday, so my previous reply was a bit short.
The reason why the Nano Every only work with the Nano Every pinout is because of an artifact in the IDE I've worked around. The Nano Every requires a "1200bps touch" in order to switch to "jtag2updi mode". Arduino IDE can't/doesn't perform this on programmers selected in the Programmers menu. It can only be performed if the programmer is "tied" to the pinout in boards.txt.
This was the only way I could add Nano Every support without adding a dedicated target in the Tools > boards list.
Looking at the source code for the Every's USB/Serial/UPDI thing (MuxTO), it seems to me that the 1200bps thing is the ONLY way to put the board into upload mode. Ie, unlike most Arduino boards, hitting the RESET button does NOT put the board into upload mode, even temporarily.