AVR64DD32 via UPDI, I can burn the bootloader but uploading a sketch fails?
Closed this issue · 4 comments
Did you write the fuses as well? (probably, since it looks like a screenshot from Arduino's "Burn bootloader" command.
And did you re-wire the uart port? (since you're using usbserial-310 for both.)
Complete text logs (copy&paste) are much preferred over screen shots.
Thanks for the quick reply.
This is my first time using UPDI.
I went with the defaults from the Tools setup except that I'm using an external 16M oscillator. I didn't realise I was burning fuses but you're right. Please find the image for the Tools setup below and after that both text logs. Thanks for any insights.
/Users//Library/Arduino15/packages/megaTinyCore/tools/python3/3.7.2-post1/python3 -u /Users//Library/Arduino15/packages/DxCore/hardware/megaavr/1.5.11/tools/prog.py -t uart -u /dev/cu.usbserial-310 -b 230400 -d avr64dd32 --fuses 0:0b00000000 1:0x00 2:0x00 5:0b11011000 6:0b00001100 7:0x00 8:0x01 -f /Users//Library/Arduino15/packages/DxCore/hardware/megaavr/1.5.11/bootloaders/hex/optiboot_64dd_ser0_extr.hex -a write -v
SerialUPDI
UPDI programming for Arduino using a serial adapter
Based on pymcuprog, with significant modifications
By Quentin Bolsee and Spence Konde
Version 1.3.0.3 - Jul 2023
Using serial port /dev/cu.usbserial-310 at 230400 baud.
Target: avr64dd32
Set fuses: ['0:0b00000000', '1:0x00', '2:0x00', '5:0b11011000', '6:0b00001100', '7:0x00', '8:0x01']
Action: write
File: /Users//Library/Arduino15/packages/DxCore/hardware/megaavr/1.5.11/bootloaders/hex/optiboot_64dd_ser0_extr.hex
pymcuprog.programmer - INFO - Setting up programming session for 'avr64dd32'
pymcuprog.deviceinfo.deviceinfo - INFO - Looking for device avr64dd32
pymcuprog.serialupdi.physical - INFO - Opening port '/dev/cu.usbserial-310' at '115200' baud
pymcuprog.serialupdi.link - INFO - STCS 08 to 0x03
pymcuprog.serialupdi.link - INFO - STCS 06 to 0x02
pymcuprog.serialupdi.link - INFO - LDCS from 0x00
pymcuprog.serialupdi.link - INFO - UPDI init OK
pymcuprog.serialupdi.link - INFO - STCS 06 to 0x02
pymcuprog.serialupdi.link - INFO - Setting UPDI clock to 8 MHz
pymcuprog.serialupdi.link - INFO - STCS 02 to 0x09
pymcuprog.serialupdi.physical - INFO - Switching to '230400' baud
pymcuprog.serialupdi.application - INFO - SIB: 'AVR P:2D:1-3M2 (A3.KV00K.0)'
pymcuprog.serialupdi.application - INFO - Device family ID: 'AVR'
pymcuprog.serialupdi.application - INFO - NVM interface: 'P:2'
pymcuprog.serialupdi.application - INFO - Debug interface: 'D:1'
pymcuprog.serialupdi.application - INFO - PDI oscillator: '3M2'
pymcuprog.serialupdi.application - INFO - Extra info: '(A3.KV00K.0)'
pymcuprog.serialupdi.application - INFO - Using 24-bit UPDI
pymcuprog.serialupdi.link - INFO - STCS 08 to 0x03
pymcuprog.serialupdi.link - INFO - STCS 06 to 0x02
pymcuprog.serialupdi.link - INFO - LDCS from 0x00
pymcuprog.serialupdi.link - INFO - UPDI init OK
pymcuprog.serialupdi.link - INFO - LDCS from 0x00
pymcuprog.serialupdi.application - INFO - PDI revision = 0x03
pymcuprog.serialupdi.link - INFO - LDCS from 0x0B
pymcuprog.serialupdi.link - INFO - LDCS from 0x0B
pymcuprog.serialupdi.application - INFO - Entering NVM programming mode
pymcuprog.serialupdi.link - INFO - LDCS from 0x07
pymcuprog.serialupdi.application - INFO - Apply reset
pymcuprog.serialupdi.link - INFO - STCS 59 to 0x08
pymcuprog.serialupdi.application - INFO - Release reset
pymcuprog.serialupdi.link - INFO - STCS 00 to 0x08
pymcuprog.serialupdi.link - INFO - LDCS from 0x0B
pymcuprog.serialupdi.link - INFO - LDCS from 0x0B
pymcuprog.nvm - INFO - No specific initializer for this provider
Pinging device...
pymcuprog.programmer - INFO - Reading device ID...
pymcuprog.serialupdi.application - INFO - SIB: 'AVR P:2D:1-3M2 (A3.KV00K.0)'
pymcuprog.serialupdi.application - INFO - Device family ID: 'AVR'
pymcuprog.serialupdi.application - INFO - NVM interface: 'P:2'
pymcuprog.serialupdi.application - INFO - Debug interface: 'D:1'
pymcuprog.serialupdi.application - INFO - PDI oscillator: '3M2'
pymcuprog.serialupdi.application - INFO - Extra info: '(A3.KV00K.0)'
pymcuprog.serialupdi.application - INFO - Using 24-bit UPDI
pymcuprog.serialupdi.link - INFO - STCS 08 to 0x03
pymcuprog.serialupdi.link - INFO - STCS 06 to 0x02
pymcuprog.serialupdi.link - INFO - LDCS from 0x00
pymcuprog.serialupdi.link - INFO - UPDI init OK
pymcuprog.serialupdi.link - INFO - LDCS from 0x00
pymcuprog.serialupdi.application - INFO - PDI revision = 0x03
pymcuprog.serialupdi.link - INFO - LDCS from 0x0B
pymcuprog.serialupdi.application - INFO - Device ID = '1E961A' rev 'A3'
pymcuprog.nvm - INFO - Device ID: '1E961A'
pymcuprog.nvm - INFO - Device revision: 'A3'
pymcuprog.nvm - INFO - Device serial number: 'b'424082109000961101390099''
Ping response: 1E961A
Setting fuse 0x0=0x0
Writing literal values...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 1 bytes of data to fuses...
pymcuprog.serialupdi.nvm - INFO - NVM EEPROM erase/write command
pymcuprog.serialupdi.nvm - INFO - Clear NVM command
pymcuprog.programmer - INFO - Write complete.
Verifying literal values...
pymcuprog.programmer - INFO - Reading 1 bytes from fuses...
pymcuprog.programmer - INFO - Verifying...
Action took 0.03s
Setting fuse 0x1=0x0
Writing literal values...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 1 bytes of data to fuses...
pymcuprog.serialupdi.nvm - INFO - NVM EEPROM erase/write command
pymcuprog.serialupdi.nvm - INFO - Clear NVM command
pymcuprog.programmer - INFO - Write complete.
Verifying literal values...
pymcuprog.programmer - INFO - Reading 1 bytes from fuses...
pymcuprog.programmer - INFO - Verifying...
Action took 0.03s
Setting fuse 0x2=0x0
Writing literal values...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 1 bytes of data to fuses...
pymcuprog.serialupdi.nvm - INFO - NVM EEPROM erase/write command
pymcuprog.serialupdi.nvm - INFO - Clear NVM command
pymcuprog.programmer - INFO - Write complete.
Verifying literal values...
pymcuprog.programmer - INFO - Reading 1 bytes from fuses...
pymcuprog.programmer - INFO - Verifying...
Action took 0.03s
Setting fuse 0x5=0xd8
Writing literal values...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 1 bytes of data to fuses...
pymcuprog.serialupdi.nvm - INFO - NVM EEPROM erase/write command
pymcuprog.serialupdi.nvm - INFO - Clear NVM command
pymcuprog.programmer - INFO - Write complete.
Verifying literal values...
pymcuprog.programmer - INFO - Reading 1 bytes from fuses...
pymcuprog.programmer - INFO - Verifying...
Action took 0.03s
Setting fuse 0x6=0xc
Writing literal values...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 1 bytes of data to fuses...
pymcuprog.serialupdi.nvm - INFO - NVM EEPROM erase/write command
pymcuprog.serialupdi.nvm - INFO - Clear NVM command
pymcuprog.programmer - INFO - Write complete.
Verifying literal values...
pymcuprog.programmer - INFO - Reading 1 bytes from fuses...
pymcuprog.programmer - INFO - Verifying...
Action took 0.03s
Setting fuse 0x7=0x0
Writing literal values...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 1 bytes of data to fuses...
pymcuprog.serialupdi.nvm - INFO - NVM EEPROM erase/write command
pymcuprog.serialupdi.nvm - INFO - Clear NVM command
pymcuprog.programmer - INFO - Write complete.
Verifying literal values...
pymcuprog.programmer - INFO - Reading 1 bytes from fuses...
pymcuprog.programmer - INFO - Verifying...
Action took 0.04s
Setting fuse 0x8=0x1
Writing literal values...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 1 bytes of data to fuses...
pymcuprog.serialupdi.nvm - INFO - NVM EEPROM erase/write command
pymcuprog.serialupdi.nvm - INFO - Clear NVM command
pymcuprog.programmer - INFO - Write complete.
Verifying literal values...
pymcuprog.programmer - INFO - Reading 1 bytes from fuses...
pymcuprog.programmer - INFO - Verifying...
Action took 0.03s
Finished writing fuses.
Chip/Bulk erase,
Memory type eeprom is conditionally erased (depending upon EESAVE fuse setting)
Memory type flash is always erased
Memory type lockbits is always erased
...
pymcuprog.programmer - INFO - Erase...
pymcuprog.serialupdi.nvm - INFO - Chip erase using NVM CTRL
Erased.
Action took 0.02s
Writing from hex file...
Writing flash...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 480 bytes of data to flash...
pymcuprog.serialupdi.nvm - INFO - NVM write command
pymcuprog.serialupdi.nvm - INFO - Clear NVM command
pymcuprog.programmer - INFO - Write complete.
Writing flash...
pymcuprog.programmer - INFO - Write...
pymcuprog.programmer - INFO - Writing 6 bytes of data to flash...
pymcuprog.serialupdi.nvm - INFO - NVM write command
pymcuprog.serialupdi.nvm - INFO - Clear NVM command
pymcuprog.programmer - INFO - Write complete.
Action took 0.10s
Verifying...
pymcuprog.programmer - INFO - Reading 480 bytes from flash...
pymcuprog.programmer - INFO - Verifying...
pymcuprog.programmer - INFO - Reading 512 bytes from flash...
pymcuprog.programmer - INFO - Verifying...
Verify successful. Data in flash matches data in specified hex-file
Action took 0.06s
pymcuprog.serialupdi.application - INFO - Leaving NVM programming mode
pymcuprog.serialupdi.application - INFO - Apply reset
pymcuprog.serialupdi.link - INFO - STCS 59 to 0x08
pymcuprog.serialupdi.application - INFO - Release reset
pymcuprog.serialupdi.link - INFO - STCS 00 to 0x08
pymcuprog.serialupdi.link - INFO - STCS 0C to 0x03
pymcuprog.serialupdi.physical - INFO - Closing port '/dev/cu.usbserial-310'
/Users//Library/Arduino15/packages/DxCore/tools/avrdude/6.3.0-arduino17or18/bin/avrdude -C/Users//Library/Arduino15/packages/DxCore/hardware/megaavr/1.5.11/avrdude.conf -v -pavr64dd32 -carduino -D -P/dev/cu.usbserial-310 -b115200 -Uflash:w:/var/folders/dq/q1fgnns90_3fbrbd1kbw302c0000gn/T/arduino_build_540600/T7b_170724.ino.hex:i
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 "/Users/**/Library/Arduino15/packages/DxCore/hardware/megaavr/1.5.11/avrdude.conf"
User configuration file is "/Users/**/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/cu.usbserial-310
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x20
avrdude done. Thank you.
An error occurred while uploading the sketch
You don't write the sketch using UPDI if you're trying to flash a sketch using optiboot. You write the sketch using serial like you would with any "normal" Arduino. UPDI is for burning the bootloader (and burning the program, if you are not using optiboot). Once you've burned the optiboot bootloader, connect to TX0/RX0 and your sketch upload should work fine.
SEE: https://github.com/SpenceKonde/DxCore/blob/master/megaavr/extras/Ref_Optiboot.md
UPDI is for burning the bootloader (and burning the program, if you are not using optiboot).
Thanks!