Page 1 of 1
Mega2650 reset freeze
Posted: Wed Jan 16, 2013 4:57 pm
by haley0918
Hi, I have a CRIUS AIO PRO with Mega2560 and loaded with firmware 2.1. Upon connection to the GUI, I have to stop the GUI from polling on the serial or the firmware would just freeze. Is this a normal behavior on Mega2560? Cause this doesn't happen on my Mega328 based board.
It's not just GUI, anything that connects to the default serial as long as there's polling activity during reset, the firmware would just freeze. The reset would only be successful without any activity on the serial. This is annoying as I'm attaching Minim OSD and have to hold it in reset until the Mega2560 has a successful reset.
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 10:31 am
by haley0918
I had been tracing down the fault. It turns out to be the bug on the Mega2560 bootloader.
The Mega2560 has been know for issues with its bootloader. The bootloader contains a "monitor" function that allows to bring up by sending "!!!" during reset. Although not specified by anyone anywhere, I suspect that the "monitor" function has a poorly implemented serial polling that would cause the bootloader to loop and check for each of the bytes received for "!!!". And in the case for Multiwii, a reset on the Mega2560 while the GUI kept on polling would just fix it in the bootloader until any serial activity has been stopped. The same applies when connecting any Multiwii compatible OSD to Serial0 of Mega2560.
So far I have yet to find any way to bypass the "monitor" function or any new bootloader that has this issue solved. The most recent bootloader for Mega2560 records a compile date of 8 May 2012 in the "monitor".
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 11:39 am
by Hamburger
cannot you use the modified bootloader from ronco for the promicro, replacing the leonardo bootloader?
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 12:02 pm
by haley0918
Hamburger wrote:cannot you use the modified bootloader from ronco for the promicro, replacing the leonardo bootloader?
I'm targeting this issue specifically at ATMega2560 which I have at hand. Leonardo and Ronco's bootloader does not work on this different MCU.
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 2:47 pm
by copterrichie
Just curious if using the ISP to program the ATMega2560 bypassing the Bootloader all together would resolve the problem?
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 3:06 pm
by Gimbal
have a few mega and all has stk500boot_v2_mega2560 from arduino, no probs
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 3:16 pm
by haley0918
copterrichie wrote:Just curious if using the ISP to program the ATMega2560 bypassing the Bootloader all together would resolve the problem?
By right it should, but that won't be friendly for some of our flight controller setup where only horizontal USB entry is the solution.
Looking through the bootloaders for Mega2560 and 328p, both are based on different versions of stk500 bootloader and are totally different at handling the serial reception upon start up.
On 328p, the bootloader monitors for errors and exits when over a certain amount.
On Mega2560, the bootloader doesn't monitor for errors and only exits when there's no activity on the serial.
Gimbal wrote:have a few mega and all has stk500boot_v2_mega2560 from arduino, no probs
Have you tried to reset them while connected and running with the GUI?
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 8:04 pm
by Gimbal
yup, reset> few sec and it's running again, but why would you want to reset frequently, I never use this opportunity
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 8:07 pm
by haley0918
Strange! I'd tried on both Crius AIO Pro and original Mega 2560 board. Both stuck at the bootloader.
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 8:09 pm
by copterrichie
haley0918 wrote:Strange! I'd tried on both Crius AIO Pro and original Mega 2560 board. Both stuck at the bootloader.
May I ask, how are you powering these boards and at what voltage?
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 8:13 pm
by Gimbal
mayby check fuses?
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 8:15 pm
by haley0918
I'm powering with default 5V from USB. I'd tried separate cable for power and serial data. Using terminal to send random data to the running Mega2560 and press reset. Still, stuck at bootloader until i stop sending in anything.
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 8:21 pm
by haley0918
Gimbal wrote:mayby check fuses?
May i know what are your fuse values?
I currently have:
lfuse - FF
hfuse - D8
efuse - FD
lock - FF
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 8:28 pm
by copterrichie
I recall reading something about the voltage levels on some USB ports especially on a MAC, have you tried another computer or a USB Hub?
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 8:37 pm
by haley0918
copterrichie wrote:I recall reading something about the voltage levels on some USB ports especially on a MAC, have you tried another computer or a USB Hub?
I'm not a MAC fan so yep, normal PC. Measured the voltage to be at 4.8V.
I don't see how is this is related to voltage supplied.
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 8:39 pm
by Gimbal
about the fuses, I'l have to return to you, need to power up my dragon to check
Re: Mega2650 reset freeze
Posted: Thu Jan 17, 2013 10:55 pm
by haley0918
Here's a demonstration on the issue.
http://youtu.be/GO_IrbIIy-A