platformio / platform-atmelavr

Atmel AVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelavr
Apache License 2.0
138 stars 105 forks source link

AVR Upload in Windows using USB Programmer not working #122

Closed ciphermaster closed 5 years ago

ciphermaster commented 5 years ago

Hi,

trying to upload a code to an ATMEGA328P using an AVR ISP MK2 does not work. In the Help, there is a Document saying:

https://docs.platformio.org/en/latest/platforms/atmelavr.html

[env:myenv] platform = atmelavr framework = arduino upload_protocol = stk500v2 ; each flag in a new line upload_flags = -Pusb

But this is only working on Linux.

On Windows, the correct Protocoll is avrisp2. Example:

C:\Users\xyz\.platformio\packages\tool-avrdude> .\avrdude.exe -c avrisp2 -p m328p

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude.exe: Device signature = 0x1e950f (probably m328p)

avrdude.exe: safemode: Fuses OK (E:FF, H:D1, L:62)

avrdude.exe done.  Thank you.

But whatever I try to specify it is always looking for an COM-Port (Upload-Port). It does not work without an COM-Port:

> Executing task: C:\Users\Michael\.platformio\penv\Scripts\platformio.exe run --target upload <

Processing atmega328pb (platform: atmelavr; board: atmega328pb; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/atmega328pb.html
PLATFORM: Atmel AVR > Atmel ATmega328PB
HARDWARE: ATMEGA328PB 16MHz 2KB RAM (31.50KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 29 compatible libraries
Scanning dependencies...
No dependencies
Checking size .pioenvs\atmega328pb\firmware.elf
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [          ]   0.4% (used 9 bytes from 2048 bytes)
PROGRAM: [          ]   1.8% (used 580 bytes from 32256 bytes)
Configuring upload protocol...
AVAILABLE: avrisp2
CURRENT: upload_protocol = avrisp2
Looking for upload port...
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1
======================================================================================== [ERROR] Took 0.96 seconds ========================================================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

BR Michael

ivankravets commented 5 years ago

Do you use Program target instead of uploading?

ivankravets commented 5 years ago

Please reopen if you still need help