AVRISP mk II config query

Hi @maxgerhardt,

I asked Paul to comment out those lines but it looks like he missed one, the upload_flags.

That might account for why the command line looks doubled up on parameters.

Good catch on -p versus -P.


1 Like

thanks again - here’s a screen clip of device manager and usb root properties, you can see the avrispmkII under Microchip Tools:

Sorry I wasn’t clear, I need you to open the “details” -> Hardware IDs view of the “AVRISP mkII” device.

apols, here tis:

This is good, the VID and PID are as expected.

I’m 99% sure that you’ve installed Atmel Studio and the drivers that have been installed with that are applied to the AVRISP mkII device. But avrdude can’t work with those drivers, it needs it to be accessible with libUSB. Can you try as shown per point 4 of my second-previous post followed by a verbose upload? If libusb-win32 doesn’t work, try with libusbK and then WinUSB if the device isn’t already on WinUSB.

Note that this modifies which driver is loaded for that device. I’m not 100% sure on how to get back if you need the device for Atmel Studio again, but I think either the driver changes are reset when the USB device is plugged in and out again, or the original driver type is loaded with Zadig again, or the driver package in Atmel Studio is reinstalled.

thanks Max. yes you’re right about atmel studio. I’ll review your post and see what I can do. If I have the right idea, I’m just going to try to install a usb driver for the avrisp. The avrisp came with a cd and I guess there’ll be drivers on there. I didn’t use them because the instructions mentioned installation was automatic in atmel studio. It didn’t mention that it was for exclusive use by atmel studio… :slightly_smiling_face:

I’ll see what I can do and post back.

ok, I downloaded zadig and followed process. it successfully installed the libusb driver

I also reverted my platformio.ini as shown below, thanks for any further thoughts.

verbose compiler stuff:

PS C:\Users\Paul\Documents\PlatformIO\Projects\Blink-LED-AVR> C:\Users\Paul\.platformio\penv\Scripts\pio.exe run --target upload --verbose
Processing program_via_AVRISP_mkII (platform: atmelavr; board: ATmega328p; upload_protocol: custom; upload_port: usb; upload_flags: -C $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf, -p $BOARD_MCU, -P $UPLOAD_PORT, -c avrispmkII; upload_command: avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/ATmega328p.html
PLATFORM: Atmel AVR (3.1.0) > ATmega328P/PA
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
 - tool-avrdude 1.60300.200527 (6.3.0)
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
MethodWrapper(["checkprogsize"], [".pio\build\program_via_AVRISP_mkII\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.0% (used 0 bytes from 2048 bytes)
Flash: [          ]   0.5% (used 178 bytes from 32768 bytes)
.pio\build\program_via_AVRISP_mkII\firmware.elf  :

section                    size      addr

.data                         0   8388864

.text                       178         0

.comment                     48         0

.note.gnu.avr.deviceinfo     64         0

.debug_info                1524         0

.debug_abbrev              1442         0

.debug_line                  26         0

.debug_str                  520         0

Total                      3802
<lambda>(["upload"], [".pio\build\program_via_AVRISP_mkII\firmware.hex"])
CURRENT: upload_protocol = custom
avrdude "-C C:\Users\Paul\.platformio\packages/tool-avrdude/avrdude.conf" "-p atmega328p" "-P usb" "-c avrispmkII" -U flash:w:.pio\build\program_via_AVRISP_mkII\firmware.hex:i
avrdude: can't open config file " C:\Users\Paul\.platformio\packages/tool-avrdude/avrdude.conf": Invalid argument
avrdude: error reading system wide configuration file " C:\Users\Paul\.platformio\packages/tool-avrdude/avrdude.conf"
*** [upload] Error 1
================================================================================================== [FAILED] Took 0.57 seconds ==================================================================================================
PS C:\Users\Paul\Documents\PlatformIO\Projects\Blink-LED-AVR> 


;platformio configuration file saved from notepad

;platform = atmelavr
;board = ATmega328p

platform = atmelavr
board = ATmega328p
upload_protocol= custom
upload_port = usb
upload_flags = 
    -C $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf 
    -p $BOARD_MCU
    -c avrispmkII
 ;   -c stk500v2
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

It needs to be one value per line. Please try

platform = atmelavr
board = ATmega328p
upload_protocol= custom
upload_port = usb
upload_flags = 
 ;   -c stk500v2
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

If not revert back to the second-last platformio.ini where had commented out the upload_command .

great, it’s working, code uploaded and led blinking. Thanks very much for all your time Max and Norman, much appreciated.
best wishes,