@maxgerhardt Port 22 is the CDC virtual com port (interface 1). It looks like PIO automatically wants to use that port to upload.
Here are the results of the commands.
With these drivers:
mEDBG CSMIS-DAP (Interface 0): WinUSB (v6.1.7600.16385)
mEDBG CDC (Interface 1): usbser (v7.3.0.0)
Every command gives me this response:
avrdude.exe: Version 6.3, compiled on Sep 12 2016 at 17:24:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf"
Using Port : usb
Using Programmer : xplainedmini
Overriding Baud Rate : 115200
avrdude.exe: jtag3_open_common(): Did not find any device matching VID 0x03eb and PID list: 0x2145
avrdude.exe done. Thank you.
If I switch to libusb-win32 drivers (unplug and plug back in after driver switches):
mEDBG CSMIS-DAP (Interface 0): libusb0 (v1.2.6.0)
mEDBG CDC (Interface 1): libusb0 (v1.2.6.0)
I lose the ability to communicate with the CDC virtual com port (port 22) that you believe was causing the problem when I attempt to upload using the platform IO button. When I attempt to upload using the PIO upload button, PIO tries to upload to COM 8 which is one of my RS232 adapters. So… Since COM 22 goes away when I use libusb drivers on the CDC interface 1 device, PIO just grabs the next available com port?
So I reinstall the windows driver for that interface (right click in device manager and “update driver”) and now my drivers are listed in Zadig as:
mEDBG CSMIS-DAP (Interface 0): libusb0 (v1.2.6.0)
mEDBG CDC (Interface 1): usbser (v7.3.0.0)
Which allows me to communicate with the CDC interface via a terminal.
I just want to stress that I needed to unplug the board and plug it back in after updating my drivers, if you don’t you get errors and freezes.
C:\Users\email\.platformio\packages\tool-avrdude\avrdude.exe -v -p atmega328pb -C C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf -c xplainedmini -b 115200 -D -Pusb -U flash:w:.pio\build\ATmega328PB\firmware.hex:i
avrdude.exe: Version 6.3, compiled on Sep 12 2016 at 17:24:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf"
Using Port : usb
Using Programmer : xplainedmini
Overriding Baud Rate : 115200
avrdude.exe: usbdev_open(): Found mEDBG CMSIS-DAP, serno: ATML2323020200001354
avrdude.exe: max packet size expected 512, but found 64 due to EP 0x81's wMaxPacketSize
avrdude.exe: Found CMSIS-DAP compliant device, using EDBG protocol
AVR Part : ATmega328PB
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : JTAG3_ISP
Description : Atmel AVR XplainedMini in ISP mode
Vtarget : 5.0 V
SCK period : 8.00 us
avrdude.exe: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude.exe: Device signature = 0x1e950f (probably m328p)
avrdude.exe: Expected signature for ATmega328PB is 1E 95 16
Double check chip, or use -F to override this check.
avrdude.exe done. Thank you.
Doh! My board is a 328p Xplained Mini, not the 328pb. I edit that argument in the command.
PS C:\Users\email\Documents\PlatformIO\Projects\328pXplained_test> C:\Users\email\.platformio\packages\tool-avrdude\avrdude.exe -v -p atmega328p -C C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf -c xplainedmini -b 115200 -D -Pusb -U flash:w:.pio\build\ATmega328PB\firmware.hex:i
avrdude.exe: Version 6.3, compiled on Sep 12 2016 at 17:24:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf"
Using Port : usb
Using Programmer : xplainedmini
Overriding Baud Rate : 115200
avrdude.exe: usbdev_open(): Found mEDBG CMSIS-DAP, serno: ATML2323020200001354
avrdude.exe: max packet size expected 512, but found 64 due to EP 0x81's wMaxPacketSize
avrdude.exe: Found CMSIS-DAP compliant device, using EDBG protocol
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : JTAG3_ISP
Description : Atmel AVR XplainedMini in ISP mode
Vtarget : 5.0 V
SCK period : 8.00 us
avrdude.exe: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude.exe: Device signature = 0x1e950f (probably m328p)
avrdude.exe: safemode: hfuse reads as DF
avrdude.exe: safemode: efuse reads as FF
avrdude.exe: reading input file ".pio\build\ATmega328PB\firmware.hex"
avrdude.exe: writing flash (1110 bytes):
Writing | ################################################## | 100% 1.04s
avrdude.exe: 1110 bytes of flash written
avrdude.exe: verifying flash memory against .pio\build\ATmega328PB\firmware.hex:
avrdude.exe: load data flash data from input file .pio\build\ATmega328PB\firmware.hex:
avrdude.exe: input file .pio\build\ATmega328PB\firmware.hex contains 1110 bytes
avrdude.exe: reading on-chip flash data:
Reading | ################################################## | 100% 1.07s
avrdude.exe: verifying ...
avrdude.exe: verification error, first mismatch at byte 0x0006
0x8a != 0xae
avrdude.exe: verification error; content mismatch
avrdude.exe: safemode: hfuse reads as DF
avrdude.exe: safemode: efuse reads as FF
avrdude.exe: safemode: Fuses OK (E:FF, H:DF, L:E0)
avrdude.exe done. Thank you.
And like you mentioned, It looks like I need the erase argument, so I add the -e to the end of the command.
PS C:\Users\email\Documents\PlatformIO\Projects\328pXplained_test> C:\Users\email\.platformio\packages\tool-avrdude\avrdude.exe -v -p atmega328p -C C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf -c xplainedmini -b 115200 -D -Pusb -U flash:w:.pio\build\ATmega328PB\firmware.hex:i -e
avrdude.exe: Version 6.3, compiled on Sep 12 2016 at 17:24:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf"
Using Port : usb
Using Programmer : xplainedmini
Overriding Baud Rate : 115200
avrdude.exe: usbdev_open(): Found mEDBG CMSIS-DAP, serno: ATML2323020200001354
avrdude.exe: max packet size expected 512, but found 64 due to EP 0x81's wMaxPacketSize
avrdude.exe: Found CMSIS-DAP compliant device, using EDBG protocol
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : JTAG3_ISP
Description : Atmel AVR XplainedMini in ISP mode
Vtarget : 5.0 V
SCK period : 8.00 us
avrdude.exe: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude.exe: Device signature = 0x1e950f (probably m328p)
avrdude.exe: safemode: hfuse reads as DF
avrdude.exe: safemode: efuse reads as FF
avrdude.exe: erasing chip
avrdude.exe: reading input file ".pio\build\ATmega328PB\firmware.hex"
avrdude.exe: writing flash (1908 bytes):
Writing | ################################################## | 100% 1.78s
avrdude.exe: 1908 bytes of flash written
avrdude.exe: verifying flash memory against .pio\build\ATmega328PB\firmware.hex:
avrdude.exe: load data flash data from input file .pio\build\ATmega328PB\firmware.hex:
avrdude.exe: input file .pio\build\ATmega328PB\firmware.hex contains 1908 bytes
avrdude.exe: reading on-chip flash data:
Reading | ################################################## | 100% 1.77s
avrdude.exe: verifying ...
avrdude.exe: 1908 bytes of flash verified
avrdude.exe: safemode: hfuse reads as DF
avrdude.exe: safemode: efuse reads as FF
avrdude.exe: safemode: Fuses OK (E:FF, H:DF, L:E0)
avrdude.exe done. Thank you.
This successfully runs my program that blinks the LED and prints hello world to port 22.
Just to check I ran the other commands you suggested, and here are the results:
It looks like it works fine without the -Pusb argument.
C:\Users\email\.platformio\packages\tool-avrdude\avrdude.exe -v -p atmega328p -C C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf -c xplainedmini -b 115200 -D -U flash:w:.pio\build\ATmega328PB\firmware.hex:i -e
avrdude.exe: Version 6.3, compiled on Sep 12 2016 at 17:24:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf"
Using Port : usb
Using Programmer : xplainedmini
Overriding Baud Rate : 115200
avrdude.exe: usbdev_open(): Found mEDBG CMSIS-DAP, serno: ATML2323020200001354
avrdude.exe: max packet size expected 512, but found 64 due to EP 0x81's wMaxPacketSize
avrdude.exe: Found CMSIS-DAP compliant device, using EDBG protocol
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : JTAG3_ISP
Description : Atmel AVR XplainedMini in ISP mode
Vtarget : 5.0 V
SCK period : 8.00 us
avrdude.exe: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude.exe: Device signature = 0x1e950f (probably m328p)
avrdude.exe: safemode: hfuse reads as DF
avrdude.exe: safemode: efuse reads as FF
avrdude.exe: erasing chip
avrdude.exe: reading input file ".pio\build\ATmega328PB\firmware.hex"
avrdude.exe: writing flash (1908 bytes):
Writing | ################################################## | 100% 1.80s
avrdude.exe: 1908 bytes of flash written
avrdude.exe: verifying flash memory against .pio\build\ATmega328PB\firmware.hex:
avrdude.exe: load data flash data from input file .pio\build\ATmega328PB\firmware.hex:
avrdude.exe: input file .pio\build\ATmega328PB\firmware.hex contains 1908 bytes
avrdude.exe: reading on-chip flash data:
Reading | ################################################## | 100% 1.77s
avrdude.exe: verifying ...
avrdude.exe: 1908 bytes of flash verified
avrdude.exe: safemode: hfuse reads as DF
avrdude.exe: safemode: efuse reads as FF
avrdude.exe: safemode: Fuses OK (E:FF, H:DF, L:E0)
avrdude.exe done. Thank you.
xplainedmini_dw fails.
C:\Users\email\.platformio\packages\tool-avrdude\avrdude.exe -v -p atmega328p -C C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf -c xplainedmini_dw -b 115200 -D -Pusb -U flash:w:.pio\build\ATmega328PB\firmware.hex:i -e
avrdude.exe: Version 6.3, compiled on Sep 12 2016 at 17:24:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf"
Using Port : usb
Using Programmer : xplainedmini_dw
Overriding Baud Rate : 115200
avrdude.exe: usbdev_open(): Found mEDBG CMSIS-DAP, serno: ATML2323020200001354
avrdude.exe: max packet size expected 512, but found 64 due to EP 0x81's wMaxPacketSize
avrdude.exe: Found CMSIS-DAP compliant device, using EDBG protocol
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : JTAGICE3_DW
Description : Atmel AVR XplainedMini in debugWIRE mode
ICE hardware version: 0
ICE firmware version: 1.00 (rel. 0)
Serial number : ATML2323020200001354
Vtarget : 5.00 V
JTAG clock megaAVR/program: 0 kHz
JTAG clock megaAVR/debug: 0 kHz
JTAG clock Xmega: 0 kHz
PDI clock Xmega : 0 kHz
avrdude.exe: bad response to AVR sign-on command: 0xa0
avrdude.exe: retrying with external reset applied
avrdude.exe: bad response to AVR sign-on command: 0xa0
avrdude.exe: retrying with external reset applied
avrdude.exe: JTAGEN fuse disabled?
avrdude.exe: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude.exe done. Thank you.
xplainedpro fails.
C:\Users\email\.platformio\packages\tool-avrdude\avrdude.exe -v -p atmega328p -C C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf -c xplainedpro -b 115200 -D -Pusb -U flash:w:.pio\build\ATmega328PB\firmware.hex:i
avrdude.exe: Version 6.3, compiled on Sep 12 2016 at 17:24:16
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\email\.platformio\packages\tool-avrdude\avrdude.conf"
Using Port : usb
Using Programmer : xplainedpro
Overriding Baud Rate : 115200
avrdude.exe: jtag3_open_common(): Did not find any device matching VID 0x03eb and PID list: 0x2111
avrdude.exe done. Thank you.
Thanks a lot for the help so far. Any suggestions on correcting the PIO update behavior and getting debugging working?