Welcome! Log In Create A New Profile

Advanced

Bootloader/flash issues with Trigorilla board (Mega2560)

Posted by neo2001 
Bootloader/flash issues with Trigorilla board (Mega2560)
October 11, 2020 07:28AM
I've replaced the stock display of my Anycubic i3 Mega S with a Fystec Mini 12864 (which is connected using the EXP1 and EXP2 headers). In the process, I've removed the "Switch" daughter-board from Anycubic and connected the endstops and other devices directly to the board.

Until then, I've uploaded new firmware binaries, using the Octoprint Firmware Flash plugin, which is basically using avrdude with the "wiring" "programmer" to flash the firmware using the USB connection and therefore the bootloader of the ATMega2560 MCU.

After reconfiguring and recompiling my Marlin sources, I built a new image and flashed it the same way... which also worked fine.

This is my current configuration: [github.com]

The display works and the printer too, although, I didn't do any detailed testing yet.

The problem is, that I can't upload new firmware using the USB connection (be it Octoprint or manually with avrdude) anymore. I always get a timeout error.

$ avrdude -p atmega2560 -c wiring -P /dev/ttyUSB0 -b 250000 -D -U flash:w:firmware.hex:i
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done.  Thank you.

I then used the ISP header and an USBasp adapter to burn the bootloader using the latest Arduino IDE.

After that, I can upload the software again, but only once! But as soon as the firmware is flashed any subsequent tries end in the same timeout error as before.

The only way is to reburn the bootloader every time I want to update the firmware. Or use the ISP interface to flash the firmware directly (... but then I get an checksum error... which maybe another issue).

I tried to press the reset button while uploading many times, at different times in the upload process, but this never worked.

So I assume, that the bootloader somehow gets damaged as soon as a new software is flashed. Also, maybe the reason isn't the display itself at all, but the larger firmware image.

Any ideas what to try next?
Re: Bootloader/flash issues with Trigorilla board (Mega2560)
October 12, 2020 07:53AM
In the meantime I found out that the upload does indeed work, if I press the reset button exactly when starting the avrdude command. I've tried that before, but for whatever reasons, it didn't worked then.

I'm not sure, but deleting the bootloader may have been my own fault by omitting the -D option for avrdude, which prevents it from erasing the chip before programming.

Now I still wonder why flashing without pressing the reset button was possible before?

As far as I remember an Arduino gets reset when connecting via USB, which allows the bootloader to accept the connection for uploading the firmware.

This seem to have worked before. Since I removed the Anycubic daughter-board ("Switch") and added an 12864 display (which also comes with a reset button), it maybe has something to do with that. Maybe some missing caps on the "Switch" board or the LCD somehow influencing the reset line of the MCU?
Re: Bootloader/flash issues with Trigorilla board (Mega2560)
October 12, 2020 09:47AM
normally reset happens when DTR line on usb/serial converter goes low. on a real mega anyways
Sorry, only registered users may post in this forum.

Click here to login