Mega2650 reset freeze

Post Reply
haley0918
Posts: 28
Joined: Tue Mar 06, 2012 9:09 am

Mega2650 reset freeze

Post 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.

haley0918
Posts: 28
Joined: Tue Mar 06, 2012 9:09 am

Re: Mega2650 reset freeze

Post 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".

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Mega2650 reset freeze

Post by Hamburger »

cannot you use the modified bootloader from ronco for the promicro, replacing the leonardo bootloader?

haley0918
Posts: 28
Joined: Tue Mar 06, 2012 9:09 am

Re: Mega2650 reset freeze

Post 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.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Mega2650 reset freeze

Post by copterrichie »

Just curious if using the ISP to program the ATMega2560 bypassing the Bootloader all together would resolve the problem?

Gimbal
Posts: 146
Joined: Tue Jul 24, 2012 7:14 pm
Location: Sweden

Re: Mega2650 reset freeze

Post by Gimbal »

have a few mega and all has stk500boot_v2_mega2560 from arduino, no probs

haley0918
Posts: 28
Joined: Tue Mar 06, 2012 9:09 am

Re: Mega2650 reset freeze

Post 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?

Gimbal
Posts: 146
Joined: Tue Jul 24, 2012 7:14 pm
Location: Sweden

Re: Mega2650 reset freeze

Post by Gimbal »

yup, reset> few sec and it's running again, but why would you want to reset frequently, I never use this opportunity
Last edited by Gimbal on Thu Jan 17, 2013 8:12 pm, edited 1 time in total.

haley0918
Posts: 28
Joined: Tue Mar 06, 2012 9:09 am

Re: Mega2650 reset freeze

Post by haley0918 »

Strange! I'd tried on both Crius AIO Pro and original Mega 2560 board. Both stuck at the bootloader.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Mega2650 reset freeze

Post 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?

Gimbal
Posts: 146
Joined: Tue Jul 24, 2012 7:14 pm
Location: Sweden

Re: Mega2650 reset freeze

Post by Gimbal »

mayby check fuses?

haley0918
Posts: 28
Joined: Tue Mar 06, 2012 9:09 am

Re: Mega2650 reset freeze

Post 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.

haley0918
Posts: 28
Joined: Tue Mar 06, 2012 9:09 am

Re: Mega2650 reset freeze

Post 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

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: Mega2650 reset freeze

Post 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?

haley0918
Posts: 28
Joined: Tue Mar 06, 2012 9:09 am

Re: Mega2650 reset freeze

Post 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.

Gimbal
Posts: 146
Joined: Tue Jul 24, 2012 7:14 pm
Location: Sweden

Re: Mega2650 reset freeze

Post by Gimbal »

about the fuses, I'l have to return to you, need to power up my dragon to check

haley0918
Posts: 28
Joined: Tue Mar 06, 2012 9:09 am

Re: Mega2650 reset freeze

Post by haley0918 »

Here's a demonstration on the issue.

http://youtu.be/GO_IrbIIy-A

Post Reply