Welcome, Guest. Please login or register.

Username: Password:

Author Topic: Update Utility fails with Mega 2560 on Windows 10  (Read 4324 times)

paul_astrix

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Update Utility fails with Mega 2560 on Windows 10
« on: May 08, 2017, 14:23:31 »

I can upload a simple blinking light demo project from the Arduino toolkit,  to test the board

But I cannot make a successful transfer with the AstroEQ Installer.

1) Update Firmware. This starts the RX/TX lights flashing for several seconds, then avrdude seems to consume 100% cpu for several seconds. Pressing Next then starts reading the EEPROM, but no data is transferred and the RX/TX lights do not flash....then I get "Read Error! Connection Unavailable."

During the transfer there are several messages about "skipping pages", but I cannot scroll back to see the avrdude messages, using mouse, trackpad or cursor keys.

2) Configure. The "L" led flashes a few times, a few seconds later the RX LED blips quickly and everything does dead. Eventually the Utility times-out with the same error message.

In Device Manager the latest Arduino LLC driver is used V 1.2.2.0 dated 15/06/2015

I have tried a variety of UART speeds from 9600 to 115200, no change.

I updated JAVA to 1.8.0-123, no change.

It would appear that avrdude locks up or fails in some way.

cheers
Paul
Logged

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: Update Utility fails with Mega 2560 on Windows 10
« Reply #1 on: May 08, 2017, 14:33:15 »

Hi,

A similar question was asked here. The issue is due to a fault with the Arduino 2560 Bootloader.


I've confirmed that the problem is due to the bootloader for the Arduino Mega2560 being very flaky when it comes to its handling of the watchdog. The Mega 2560 I have is 4 years old so has an old bootloader that exhibits the same problem.

After a bit of reading around, I've flashed the newer (2013) bootloader from the Arduino github:
https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/bootloaders/stk500v2/stk500boot_v2_mega2560.hex

Having flashed that bootloader the problem is resolved - it can now run the test step without having to unplug the USB.

If you have another Arduino to hand or some other AVR programmer, I would highly advise anyone with an Arduino Mega 2560 version (doesn't affect the Mega 1280 or AstroEQ boards) to flash the new bootloader. Even many of the new production boards and clones use the old bootloader, so even if you bought it after 2013 it will likely need updating.

Also the "skipping pages" is nothing to worry about. It's avrdude saying that it doesn't need to program some of the flash memory because the AstroEQ firmware is only using ~11kB of 256kB.

Kind Regards,
Tom.
« Last Edit: May 08, 2017, 14:36:47 by TCWORLD »
Logged
Tom Carpenter (AstroEQ)

paul_astrix

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Update Utility fails with Mega 2560 on Windows 10
« Reply #2 on: May 08, 2017, 16:06:08 »

Thanks Tom,

I'm not sure how to reprogram the MEGA, I tried using the Arduino IDE which no success.

I have a spare Arduino Duo, but Google throws up a lot of spaghetti that leads nowhere..... ;)

-Paul
Logged

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: Update Utility fails with Mega 2560 on Windows 10
« Reply #3 on: May 08, 2017, 17:41:19 »

You'll need an AVR programmer to update the bootloader. If you have another Arduino it should be possible to use the ArduinoISP sketch to reprogram the mega.

I'm not sure what an Arduino Duo is, so couldn't say whether or not it can be used as a programmer. (Did you mean Arduino Due?).

Otherwise you'll have to resort to what others have been doing which is to just unplug the USB cable and plug it back in after the firmware is uploaded, but before clicking next.
Logged
Tom Carpenter (AstroEQ)

paul_astrix

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Update Utility fails with Mega 2560 on Windows 10
« Reply #4 on: May 08, 2017, 18:33:13 »

Hi,

My typo. It's an Uno and I have found the Arduino ISP tutorial:

https://www.arduino.cc/en/Tutorial/ArduinoISP

cheers
Paul

Logged

paul_astrix

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Update Utility fails with Mega 2560 on Windows 10
« Reply #5 on: May 08, 2017, 21:01:14 »

I could not get the Arduino ISP to work (using a Uno) to re-program the Mega bootloader. Due to avrdude error "unknown device ID" aka Made in China.  :)

So I've more or less given up the idea as a waste of time. Maybe a simple ISP programmer from ebay will work.
Logged

paul_astrix

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Update Utility fails with Mega 2560 on Windows 10
« Reply #6 on: May 11, 2017, 20:55:38 »

I bought a USBasp programmer from Ebay, programmed the new hex file into my Mega 2560 with eXtreme Burner AVR........and its as dead as a do-do. I don't think the oscillator runs as the Reset button doesn't cause any LEDs to flicker.

Maybe the complete chip erase was not so wise. I have to dig around to understand the oscillator settings and powerup settings.

Joy!

-Paul
Logged

TCWORLD

  • Administrator
  • *****
  • Posts: 809
    • View Profile
    • AstroEQ
Re: Update Utility fails with Mega 2560 on Windows 10
« Reply #7 on: May 11, 2017, 22:23:01 »

Hmm. What command did you use to burn it?

Try the following.

1. Save the "stk500boot_v2_mega2560.hex" file in the hex/ folder of the config utility (don't change the name)
2. Open the cmd and cd to the bin/ folder of the config utility
3. Run the following command:
Code: [Select]
avrdude -C../etc/avrdude.conf -p atmega2560 -c usbasp -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m -Uflash:w:../hex/stk500boot_v2_mega2560.hex:i -v -v -v
That should set the fuse values correctly and upload the bootloader.
Logged
Tom Carpenter (AstroEQ)

paul_astrix

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Update Utility fails with Mega 2560 on Windows 10
« Reply #8 on: May 12, 2017, 15:37:49 »

Tom I've only just read your message.

But I decided I had to learn avrdude, so I installed it and eventually got the USBasp programmer to program the board via the 6-pin ISP with this command:

avrdude -c usbasp -u -U flash:w:stk500boot_V2_mega250.hex

There seems to be no need for fuse settings as avrdude works in "safe mode" by default. I think it sets default xtal fuse settings, but I'm not 100% sure.

Zadig 2.3 is an excellent signed driver for USBasp drivers and more. I installed libusb-win32 (v 1.2.6.0) which is an open source USB driver library, which mounted the USBasp programmer as a USB device. Its a cheap programmer, under £5, a Chinese clone of the original design (I think) by Thomas Fischl:

http://www.fischl.de/usbasp/

Then I could run your Install Utility, but Java seemed to hang after firmware upload so I killed the install. Then started install to read the EEprom which was empty, I programmed the EQ5-belt config and the data uploaded ok.

Yes  the long way round, but I learnt a lot and feel quite proud. But thanks for your suggestion.

cheers
Paul
Logged

paul_astrix

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Update Utility fails with Mega 2560 on Windows 10
« Reply #9 on: May 12, 2017, 16:25:16 »

Hmm. What command did you use to burn it?

I used eXtreme Burner - AVR 1.4, after smuggling an unsigned driver into Windows 10 with Shift + Reset, which on startup allows many special modes, like "allow Alien device drivers".

I thought erasing the chip would be a clean start (ha-ha), but it blows away the eeprom, flash and fuses. I did my best to select the external Crystal oscillator. I should have Read all 3 sets of data and made a backup, but that's life!

cheers
-Paul
« Last Edit: May 12, 2017, 18:22:24 by paul_astrix »
Logged