PlatformIO Community

PIO Windows Platform Error 1


#32

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 -> http://bit.ly/pio-memory-usage

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


#33

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. (https://electronics.stackexchange.com/questions/37476/failing-to-write-atmega16u4-fuses-with-avrdude). 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 https://docs.platformio.org/en/latest/platforms/atmelavr.html#upload-using-programmer for usbASP or Arduino as ISP respectively in the platformio.ini file and use the pio run -t program “Upload using programmer” target.


#34

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


#35

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


#36

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?


#37

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

#38

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.


#39

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


#40

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?


#41

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


#42

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…


#43

celebrated a little early. I powered it all back up and my screen on the printer just has 2 rows out of 4 with blocks going across.

Is there something in the config file I need to enable for this?


#44

There are a million config options listed here: http://marlinfw.org/docs/configuration/configuration.html which give instructions on how to modify the Configuration.h file (https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/Configuration.h). E.g. character-based (which you apparently have) or graphical LCDs are configured here. Unless you know every detail of your 3D printer I would not attempt to create your own configuration, but instead ask those people you know what the correct Marlin configuration for your hardware is, otherwise this is very cumbersome. If the LCD doesn’t work, chances are other stuff doesn’t too. But at least you can now upload new firmwares to the board to update it.


#45

Here’s a link collection that might help you for the configuration:


#46

I found in the config file a a bunch of options for different boards. they have a section just for my board I just have to uncomment the section for the LCD


#47

Ok I think I have better news. In the Marlin folder of the file they have example_configurations folder that has a bunch of different printers that must use the marlin firmware and the x3a is in there. So I might be in luck.


#48

Oh right there is https://github.com/MarlinFirmware/Marlin/tree/1.1.x/Marlin/example_configurations/Tronxy/X3A. Does it work when you replace the old config files with these two headers files?


#49

OK… So I started over from scratch. I took out deleted the conf file and config adv file from the platformio.ini and replaced it with the ones in the example folder. I made the changes you gave me in previous post. I also had to install LiquidCrystal.h it was missing for the LCD. After that I did a PIO Build and succeeded. Then did a upload with programmer and it loaded perfectly. :slight_smile: I turned on my printer and BAM it works.

I really appreciate ALL you help. THANK YOU


#50

Ok I have not printed but it seems to be working. I do have a couple little issues.

  1. When powered off then back on the X Y Z flash from 0 to ?
    after auto home I get values
  2. If I leave it at idle it will flash with the values.
    Any ideas?

#51

Sounds great :+1:

I think it’s best to ask the people who wrote the firmware on questions on why the Marlin firmware does something specifically. E.g., open an issue at https://github.com/MarlinFirmware/Marlin/issues with the Marlin version you’re running and your configuration.