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

Uploading to Adafruit Flora does not work and breaks serial communication #161

Open lgut opened 5 years ago

lgut commented 5 years ago

Configuration

OS: Manjaro Platformio Version: 4.0.2

Description

Attempting to upload to the Flora board results in an error message, which I will post below. Afterwords the serial port which get created at /dev/ACM0 is only available for a brief window of time before disappearing. Using the Arduino IDE to upload in that brief window fixes all issues, but then I'm back to using the Arduino IDE. Let me know if more information is needed.

platformio.ini

[env:flora8]
platform = atmelavr
board = flora8
framework = arduino

Upload error output

> Executing task: platformio run --verbose --target upload <

Processing flora8 (platform: atmelavr; board: flora8; framework: arduino)
-------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/flora8.html
PLATFORM: Atmel AVR 1.15.0 > Adafruit Flora
HARDWARE: ATMEGA32U4 8MHz, 2.50KB RAM, 28KB Flash
PACKAGES: toolchain-atmelavr 1.50400.190710 (5.4.0), framework-arduinoavr 4.1.1, tool-avrdude 1.60300.190424 (6.3.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
MethodWrapper(["checkprogsize"], [".pio/build/flora8/firmware.elf"])
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [=         ]   5.8% (used 149 bytes from 2560 bytes)
PROGRAM: [=         ]  14.3% (used 4112 bytes from 28672 bytes)
.pio/build/flora8/firmware.elf  :
section                     size      addr
.data                         38   8388864
.text                       4074         0
.bss                         111   8388902
.comment                      48         0
.note.gnu.avr.deviceinfo      64         0
.debug_info                 2548         0
.debug_abbrev               2410         0
.debug_line                   26         0
.debug_str                   881         0
Total                      10200
<lambda>(["upload"], [".pio/build/flora8/firmware.hex"])
AVAILABLE: avr109
CURRENT: upload_protocol = avr109
BeforeUpload(["upload"], [".pio/build/flora8/firmware.hex"])
Auto-detected: /dev/ttyACM0
Forcing reset using 1200bps open/close on port /dev/ttyACM0
Waiting for the new upload port...
avrdude -v -p atmega32u4 -C /home/luis/.platformio/packages/tool-avrdude/avrdude.conf -c avr109 -b 57600 -D -P "/dev/ttyACM0" -U flash:w:.pio/build/flora8/firmware.hex:i

avrdude: Version 6.3, compiled on Sep 12 2016 at 15:21:49
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/luis/.platformio/packages/tool-avrdude/avrdude.conf"
         User configuration file is "/home/luis/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 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 : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; Hardware Version = 
.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: safemode: hfuse reads as D0
avrdude: safemode: efuse reads as CB
avrdude: reading input file ".pio/build/flora8/firmware.hex"
avrdude: writing flash (4112 bytes):

Writing | ####################################avrdude: error: programmer did not respond to command: set addr
############## | 100% 0.32s

avrdude: 4112 bytes of flash written
avrdude: verifying flash memory against .pio/build/flora8/firmware.hex:
avrdude: load data flash data from input file .pio/build/flora8/firmware.hex:
avrdude: input file .pio/build/flora8/firmware.hex contains 4112 bytes
avrdude: reading on-chip flash data:

Reading | #avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
##avrdude: error: programmer did not respond to command: set addr
## | 100% 0.08s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x0d != 0x0c
avrdude: verification error; content mismatch

avrdude: safemode: Verify error - unable to read hfuse properly. Programmer may not be reliable.
avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude: safemode: Sorry, reading back fuses was unreliable. I have given up and exited programming mode
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: error: programmer did not respond to command: exit bootloader

avrdude done.  Thank you.

*** [upload] Error 1
======================================== [FAILED] Took 4.43 seconds ========================================
The terminal process terminated with exit code: 1

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

And if it would be helpful, this is the output of avrdude when run from the Arduino IDE

Arduino IDE output

Sketch uses 4116 bytes (14%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes of dynamic memory.
Forcing reset using 1200bps open/close on port /dev/ttyACM0
PORTS {/dev/ttyACM0, } / {} => {}
PORTS {} / {/dev/ttyACM0, } => {/dev/ttyACM0, }
Found upload port: /dev/ttyACM0
/home/luis/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/bin/avrdude -C/home/luis/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_557461/sketch_aug27a.ino.hex:i 

avrdude: Version 6.3-20171130
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/luis/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/etc/avrdude.conf"
         User configuration file is "/home/luis/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 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 : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
    Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
    Device code: 0x44

avrdude: devcode selected: 0x44
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "/tmp/arduino_build_557461/sketch_aug27a.ino.hex"
avrdude: writing flash (4116 bytes):

Writing | ################################################## | 100% 0.65s

avrdude: 4116 bytes of flash written
avrdude: verifying flash memory against /tmp/arduino_build_557461/sketch_aug27a.ino.hex:
avrdude: load data flash data from input file /tmp/arduino_build_557461/sketch_aug27a.ino.hex:
avrdude: input file /tmp/arduino_build_557461/sketch_aug27a.ino.hex contains 4116 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.06s

avrdude: verifying ...
avrdude: 4116 bytes of flash verified

avrdude done.  Thank you.