Welcome! Log In Create A New Profile

Advanced

Melzi 2.0 with Marlin 1.1.9 endstops are not working

Posted by vinibali 
Melzi 2.0 with Marlin 1.1.9 endstops are not working
September 24, 2019 01:39PM
Hello there!

I have a Trony P802 which was working fine with the factory shipped Reprap 0.91 and with Marlin 1.1.9 which was compiled and uploaded by me.
Both versions worked fine, until I made some changes in the source files, recompiled it and unfortunately I uploaded the wrong binary without the bootloader.
After that, I successfully reuploaded the working binary with the bootloader, but the endstops - at least on the y axis - has stopped working, autohome fails and the servo motor just tries to move the heatbed after it reached the top end.
I found that part on the wiki page: X axis only moves in one direction and/or Endstops do not work.
I have the latest Sanguino version (1.0.3) in the Arduino builder files, so the fuse settings had to be correct from the beginning, right? I'm asking, because after I reuploaded the binary, I had to also change the fuse setting with avrdude, because - maybe - all of them were FF. But this didn't had any effect at all.
I'm afraid for some reason the controller doesn't applies the written changes, can the bootloader overwrites it?
I also had a try with the full working Reprap dump (created with avrdude), but no luck.
I also had couple of other ideas, like uploading the bootloader with ISP and upload the whole firmware on USB an so on...

[user@comp]: /media/ramdisk>$ sudo avrdude -c usbasp -p m1284p 
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e9705 (probably m1284p)
avrdude: safemode: Fuses OK (E:FD, Hgrinning smileyE, L:FF)
avrdude done.  Thank you.

Thanks

Edited 1 time(s). Last edit at 09/24/2019 03:05PM by vinibali.
Re: Melzi 2.0 with Marlin 1.1.9 endstops are not working
September 24, 2019 11:00PM
The fuse setting depend on the board. the fuse setting that comes with a generic Sanguino are probably not the same as your board as they do tend to leave jtag enabled

leaving the jtag enabled will disable the standard IO functions for the jtag pins, which is used as standard IO on reprap.

But the fuse values you show do have jtag disabled
see this fuse calculator [eleccelerator.com]

Edited 2 time(s). Last edit at 09/24/2019 11:05PM by Dust.
Re: Melzi 2.0 with Marlin 1.1.9 endstops are not working
September 25, 2019 12:30PM
These values are coming from the reprap Mezli page, these should be accurate. Unfortunately I didn't have a single line backup from the previous sessions, where I used to execute avrdude to figure out what would be the original fuse settings. I asked the FB community for this printer.
Do you think the bootloader settings can overwrite the fuses which are burned into the empty controller?

Thanks
Re: Melzi 2.0 with Marlin 1.1.9 endstops are not working
September 25, 2019 10:39PM
Arduino IDE always over writes the fuse values when it writes a new bootloader.

The only way to avoid this is to use avrdude directly on the command line

The Sanguino boards.txt file defines the fuses it will use [github.com]

for the ATmega1284P (16MHz)
atmega1284p.bootloader.low_fuses=0xFF
atmega1284p.bootloader.high_fuses=0xDE
atmega1284p.bootloader.extended_fuses=0xFD
atmega1284p.bootloader.unlock_bits=0x3F
atmega1284p.bootloader.lock_bits=0x0F

This also disabled the jtag

I think your chasing a red hearing

jtag uses 4 io pins
18 PC2 TCK (JTAG Test Clock)
19 PC3 TMS (JTAG Test Mode Select)
20 PC4 TDO (JTAG Test Data Output)
21 PC5 TDI (JTAG Test Data Input)

This would break arduino pins 18,19,20 and 21
Ie all of the following would stop working
X_STOP_PIN
Y_STOP_PIN
Z_STOP_PIN
X_DIR_PIN
Re: Melzi 2.0 with Marlin 1.1.9 endstops are not working
September 26, 2019 03:08PM
Arduino IDE always over writes the fuse values when it writes a new bootloader.
At the time when I used the IDE to upload the correct binaries - after the bad flash - it just left all the fuses at value 0xFF.

The Sanguino boards.txt file defines the fuses it will use [github.com]
I just found, the fuses are defined in the Makefile, I thought maybe the precompiled binaries (like: optiboot_atmega1284p.hex) store some bad settings inside, and this overrun the fuse settings burned to the controller.

I tried to power on the printer with the wrong fuse settings and of course it was working like in the description. All the axis were moving just to one direction.
And finally I realized, the Y and X-axis stepper motor cables has been mixed, thats totally my fault.
So Dust, thank you for this detailed explanation, I really appreciate your time and helpfulness.
I wish you a nice day/evening!

Edited 1 time(s). Last edit at 09/26/2019 03:09PM by vinibali.
Re: Melzi 2.0 with Marlin 1.1.9 endstops are not working
December 18, 2020 04:48AM
Do you think the bootloader settings can overwrite the fuses which are burned into the empty controller?
Re: Melzi 2.0 with Marlin 1.1.9 endstops are not working
January 03, 2021 05:12AM
Quote
deolsunny533
Do you think the bootloader settings can overwrite the fuses which are burned into the empty controller?

Still waiting for someone to help me with the issue . .
Re: Melzi 2.0 with Marlin 1.1.9 endstops are not working
January 03, 2021 05:50AM
Well your question doesn't make sense

boot loader settings are the fuse settings.

If you use something like Arduino IDE to upload a bootloader it will always over write the fuse settings with the fuse values in the boards.txt

If you use avrdude directly, you can upload a bootloader without changing the fuses. but it may not work.. as fuses sets size of bootloader amongst other things

Edited 2 time(s). Last edit at 01/03/2021 05:56AM by Dust.
Sorry, only registered users may post in this forum.

Click here to login