PIO Windows Platform Error 1

Okay so that tells me that a bootloader burned previously onto your ATMega1284p chip has responded but somehow writing didn’t succeed? Just to be sure when using melzi instead of melzi_optiboot you do not get this message?

I used Melzi build then Melzi Upload

Okay so for safety can you try it with melzi_optiboot too.

running upload optiboot this is what I get

Linking .pioenvs\melzi_optiboot\firmware.elf

Marlin\planner.cpp: In function ‘_set_position_mm’:

Marlin\planner.cpp:2697:1: internal compiler error: Segmentation fault

}

^

Please submit a full bug report,

with preprocessed source if appropriate.

See http://gcc.gnu.org/bugs.html for instructions.

lto-wrapper.exe: fatal error: avr-g++ returned 1 exit status

compilation terminated.

c:/users/theca/.platformio/packages/toolchain-atmelavr/bin/…/lib/gcc/avr/5.4.0/…/…/…/…/avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

*** [.pioenvs\melzi_optiboot\firmware.elf] Error 1

[ERROR] Took 65.58 seconds

[SUMMARY]

Environment megaatmega2560 [SKIP]

Environment megaatmega1280 [SKIP]

Environment at90USB1286_CDC [SKIP]

Environment at90USB1286_DFU [SKIP]

Environment melzi [SKIP]

Environment melzi_optiboot [ERROR]

Environment rambo [SKIP]

Environment sanguino_atmega644p [SKIP]

Environment sanguino_atmega1284p [SKIP]

Environment teensy20 [SKIP]

[ERROR] Took 65.58 seconds

Board name: BOARD_MELZI
Build type: upload
Environment used: melzi_optiboot

Do a project clean (Ctrl+Shift+P+“Clean” or pio run -t clean) and retry :confused:

Ok did that and re ran upload optiboot and here are the results

Linking .pioenvs\melzi_optiboot\firmware.elf

Building .pioenvs\melzi_optiboot\firmware.hex

Checking size .pioenvs\melzi_optiboot\firmware.elf

Memory Usage → Redirecting...

DATA: [== ] 15.3% (used 2513 bytes from 16384 bytes)

PROGRAM: [==== ] 41.6% (used 54112 bytes from 130048 bytes)

Configuring upload protocol…

AVAILABLE: arduino

CURRENT: upload_protocol = arduino

Looking for upload port…

Auto-detected: COM3

Uploading .pioenvs\melzi_optiboot\firmware.hex

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x73

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x74

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x61

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x72

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x74

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x0a

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x65

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x63

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x68

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x6f

avrdude done. Thank you.

*** [upload] Error 1

[ERROR] Took 74.22 seconds

[SUMMARY]

Environment megaatmega2560 [SKIP]

Environment megaatmega1280 [SKIP]

Environment at90USB1286_CDC [SKIP]

Environment at90USB1286_DFU [SKIP]

Environment melzi [SKIP]

Environment melzi_optiboot [ERROR]

Environment rambo [SKIP]

Environment sanguino_atmega644p [SKIP]

Environment sanguino_atmega1284p [SKIP]

Environment teensy20 [SKIP]

[ERROR] Took 74.24 seconds

Board name: BOARD_MELZI
Build type: upload
Environment used: melzi_optiboot

Ok that confirms that actually the melzi target is the correct one and the bootloader answrs to this. Can you clean the project again and retry with the melzi environment a few times?

Not 100% on what you mean. Can you dumb it down 1 or 2 notches? Not all the way down.

Also will I get limited today as well like yesterday? that sucked. I even paid and signed up for the year thinking it would allow me to continue :slight_smile:

And I really appreciate all you have done so far.

You tried the melzi_optiboot environment which has the bootloader baudrate at 115200 (refer here). You did not get a “Device signature = 0x1e9705” message. You tried the melzi environment with 57600 bootloader baud => the device reponds with the device signature and some readout happens => melzi should have the correct bootloader settings => retry with env_default = melzi again

If the spam-bot picks something up I can manually approve the posts since I’m a mod.

ok so If I understood you. I went into my platformio.ino and change env_default from melzi_optiboot to just Melzi and ran upload melzi and the I got this

Linking .pioenvs\melzi\firmware.elf

Checking size .pioenvs\melzi\firmware.elf

Building .pioenvs\melzi\firmware.hex

Memory Usage → Redirecting...

DATA: [== ] 15.3% (used 2513 bytes from 16384 bytes)

PROGRAM: [==== ] 41.6% (used 54112 bytes from 130048 bytes)

Configuring upload protocol…

AVAILABLE: arduino

CURRENT: upload_protocol = arduino

Looking for upload port…

Auto-detected: COM3

Uploading .pioenvs\melzi\firmware.hex

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9705 (probably m1284p)

avrdude: reading input file “.pioenvs\melzi\firmware.hex”

avrdude: writing flash (54112 bytes):

Writing | avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_recv(): programmer is not responding

Being able to read the device signature but not being able to write anything to it might be due to the LOCK bit being set, preventing it from being written to. (avr - Failing to write ATMega16U4 fuses with avrdude - Electrical Engineering Stack Exchange). The only thing that can change this lock is a complete chip erase cycle. This cannot be done via the USB/serial bootloader.

You can also try and read the fuses using avrdude with the correct MCU parameters, here e.g. described for a ATMega328P, and then decode the fuse values according to your ATMega1284P’s datasheet.

I’d suggest programming it over the 6 or 10-pin ICSP header on the board (see JP17) it using an usbasp programmer (e.g. on amazon) or, equivalently flash an Arduino Uno with the Arduino as ISP sketch. Once you have either programmer connected to the board, you can then try and use the upload_protocol and friend settings from Atmel AVR — PlatformIO latest documentation for usbASP or Arduino as ISP respectively in the platformio.ini file and use the pio run -t program “Upload using programmer” target.

ok I will try this. I have ardunio boards and jumpers to do this. I will try and be back

Ok Shoot me… I guess im getting closer… this is the error Im getting trying to upload. I know its something stupid.

Processing Melzi (framework: arduino; platform: atmelavr)

Verbose mode can be enabled via -v, --verbose option

Please specify board in platformio.ini to use with ‘arduino’ framework

[ERROR] Took 1.01 seconds

[SUMMARY]

Environment megaatmega2560 [SKIP]

Environment megaatmega1280 [SKIP]

Environment at90USB1286_CDC [SKIP]

Environment at90USB1286_DFU [SKIP]

Environment Melzi [ERROR]

Environment Melzi_optiboot [SKIP]

Environment rambo [SKIP]

Environment sanguino_atmega644p [SKIP]

Environment sanguino_atmega1284p [SKIP]

Environment teensy20 [SKIP]

[ERROR] Took 1.01 seconds

Board name: BOARD_MELZI
Build type: program
Environment used: Melzi

What is your exact platformio.ini now (please format as code), what hardware do you have connected in what way to the melzi board and what command to you use for uploading?

I have a uno card plugged in via usb

Melzi board pwer is plugged into pwr supply
I have the 4 jumper wires from uno to melzi board

I was using upload with programmer command


#
# Marlin Firmware
# PlatformIO Configuration File
#
# For detailed documentation with EXAMPLES:
#
# http://docs.platformio.org/en/latest/projectconf.html
#

# Automatic targets - enable auto-uploading
# targets = upload

#
# By default platformio build will abort after 5 errors.
# Remove '-fmax-errors=5' from build_flags below to see all.
#

[platformio]
src_dir     = Marlin
build_dir   = .pioenvs
lib_dir     = .piolib
libdeps_dir = .piolibdeps
env_default = Melzi

[common]
build_flags = -fmax-errors=5
  -g
  -ggdb
lib_deps =
  https://github.com/MarlinFirmware/U8glib-HAL/archive/dev.zip
  LiquidCrystal_I2C@1.1.2
  TMC2130Stepper
  https://github.com/teemuatlut/TMC2208Stepper/archive/v0.1.1.zip
  Adafruit NeoPixel@1.1.3
  https://github.com/lincomatic/LiquidTWI2/archive/30aa480.zip
  https://github.com/ameyer/Arduino-L6470/archive/master.zip
  https://github.com/trinamic/TMC26XStepper/archive/c1921b4.zip

#################################
#                               #
#   Unique Core Architectures   #
#                               #
#  Add a new "env" below if no  #
# entry has values suitable to  #
#   build for a given board.    #
#                               #
#################################

#
# ATmega2560
#
[env:megaatmega2560]
platform          = atmelavr
framework         = arduino
board             = megaatmega2560
build_flags       = ${common.build_flags}
board_build.f_cpu = 16000000L
lib_deps          = ${common.lib_deps}
monitor_speed     = 250000

#
# ATmega1280
#
[env:megaatmega1280]
platform          = atmelavr
framework         = arduino
board             = megaatmega1280
build_flags       = ${common.build_flags}
board_build.f_cpu = 16000000L
lib_deps          = ${common.lib_deps}
monitor_speed     = 250000

#
# AT90USB1286 boards using CDC bootloader
# - BRAINWAVE
# - BRAINWAVE_PRO
# - SAV_MKI
# - TEENSYLU
#
[env:at90USB1286_CDC]
platform      = teensy
framework     = arduino
board         = at90USB1286
build_flags   = ${common.build_flags}
lib_deps      = ${common.lib_deps}
lib_ldf_mode  = deep+
extra_scripts = pre:buildroot/share/atom/create_custom_upload_command_CDC.py

#
# AT90USB1286 boards using DFU bootloader
# - PrintrBoard
# - PrintrBoard Rev.F
# - ? 5DPRINT ?
#
[env:at90USB1286_DFU]
platform      = teensy
framework     = arduino
board         = at90USB1286
build_flags   = ${common.build_flags}
lib_deps      = ${common.lib_deps}
lib_ldf_mode  = deep+
extra_scripts = pre:buildroot/share/atom/create_custom_upload_command_DFU.py

#
# Melzi and clones (ATmega1284p)
#
[env:Melzi]
platform = atmelavr
framework = arduino
upload_protocol = stk500v1
; each flag in a new line
upload_flags =
      -P$UPLOAD_COM6
      -b$UPLOAD_57600

; edit these lines
upload_port = COM6
upload_speed = 57600

#
# Melzi and clones (Optiboot bootloader)
#
[env:Melzi_optiboot]
platform      = atmelavr
framework     = arduino
board         = sanguino_atmega1284p
build_flags   = ${common.build_flags}
upload_speed  = 115200
lib_deps      = ${common.lib_deps}
monitor_speed = 250000

#
# RAMBo
#
[env:rambo]
platform          = atmelavr
framework         = arduino
board             = reprap_rambo
build_flags       = ${common.build_flags}
board_build.f_cpu = 16000000L
lib_deps          = ${common.lib_deps}
monitor_speed     = 250000

#
# Sanguinololu (ATmega644p)
#
[env:sanguino_atmega644p]
platform      = atmelavr
framework     = arduino
board         = sanguino_atmega644p
build_flags   = ${common.build_flags}
lib_deps      = ${common.lib_deps}
monitor_speed = 250000

#
# Sanguinololu (ATmega1284p)
#
[env:sanguino_atmega1284p]
platform      = atmelavr
framework     = arduino
board         = sanguino_atmega1284p
build_flags   = ${common.build_flags}
lib_deps      = ${common.lib_deps}
monitor_speed = 250000

#
# Teensy++ 2.0
#
[env:teensy20]
platform          = teensy
framework         = arduino
board             = teensy20pp
build_flags       = ${common.build_flags}
#board_build.f_cpu = 20000000L     ; Bug in Arduino framework disallows boards running at 20Mhz
lib_deps          = ${common.lib_deps}
lib_ldf_mode      = deep+
monitor_speed     = 250000

Use the following Melzi environment, you seem to have deleted some important fields.

[env:Melzi]
platform      = atmelavr
framework     = arduino
board         = sanguino_atmega1284p
build_flags   = ${common.build_flags}
lib_deps      = ${common.lib_deps}
monitor_speed = 250000
upload_protocol = stk500v1
upload_flags =
      -P$UPLOAD_PORT
      -b$UPLOAD_SPEED
upload_port = COM6
upload_speed = 19200

This expects the Arduino (with previously flashed Arduino as ISP sketch) on COM6.

I got excited for a minute. It looked very promising.

avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.

Double check connections and try again, or use -F to override
this check.

avrdude done. Thank you.
*** [program] Error 1
[ERROR] Took 69.72 seconds

Check all power, SPI + reset connections. (common GND, MISO, MOSI, SCLK, RESET). You must have 5 wires. Double check the pin connections to the Uno and to the target’s ICSP header. E.g., are you able to measure +5V (=Vcc) and GND at the expected pins on that header? (refer Arduino as ISP).

Is the target powered powered separately and not from the Uno?

YAHOOOOOO… It is great to see that green success pop up… I had everything right except for the ground pin between the uno and melzi. I figured I didn’t need it due to the fact I wasn’t powering the melzi pord with the 5v pin. I was using a 12v pwr supply to the main board and the uno was from the pc.

time to plug it all back in and see what happens.
ill keep you posted. thanks for all your help :slight_smile:

avrdude: verifying …
avrdude: 54110 bytes of flash verified
avrdude done. Thank you.
[SUCCESS] Took 101.52 seconds
[SUMMARY]

Environment megaatmega2560 [SKIP]
Environment megaatmega1280 [SKIP]
Environment at90USB1286_CDC [SKIP]
Environment at90USB1286_DFU [SKIP]
Environment Melzi [SUCCESS]
Environment Melzi_optiboot [SKIP]
Environment rambo [SKIP]
Environment sanguino_atmega644p [SKIP]
Environment sanguino_atmega1284p [SKIP]
Environment teensy20 [SKIP]
[SUCCESS] Took 101.52 seconds

Board name: BOARD_MELZI
Build type: program
Environment used: Melzi

That look very good :smile: :+1:

The people who gave you that firmware hopefully gave you a version which has the correct pin mappins for your motors and stuff for that board etc? Or is it custom for your board and you need to change that? (I’m no expert on 3D printer setup here, but if something doesn’t work, it may be because of wrong pins in the firmware)

Ah, and it might also be intersting to see whether one can now flash the Melzi board over the USB serial bootloader with the original platformio.ini configuration…