Pages: [1] 2   Go Down
Author Topic: How to get USB-Serial hex back to Arduino UNO Rev3 / solved  (Read 4983 times)
0 Members and 1 Guest are viewing this topic.
Estonia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!

This is a bit embracing but I've managed to get my Arduino stuck thinking it is a HID device.

I created a small test program on the arduino and then used Atmel's Flip software to upload the HID.hex file from this project http://hunt.net.nz/users/darran/weblog/cca39/
Arduino successfully thinks it is a mouse now and follows the program that was uploaded prior to the hex file swap.

However now I need to make some changes to the program but I can't get back to the usb-serial.
Getting the UNO Rev3 hex file from https://github.com/arduino/Arduino/tree/master/hardware/arduino/firmwares does not help. Flip says that the Hex file is not correctly formatted :/



Can anyone advise what I'm doing wrong?
« Last Edit: May 20, 2012, 11:25:34 am by TT » Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 197
Posts: 12739
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Getting the UNO Rev3 hex file from...

What you mean by "getting the hex file"?  Did you accidentally save the HTML from the webpage rather than the HEX file?


Try this...

• Go here...
https://github.com/arduino/Arduino/blob/master/hardware/arduino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex

• On the right side, about 1/3 the way down, locate the Raw button

• Right-click Raw

• Click Save Link As

• Save the file to a convenient location

• Retry flipping
Logged

Estonia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Seems that I was indeed saving an html version of the hex.

It is better but still not there. Now when opening the HEX I get an error "Address is out of range."

In Flip, the device is set to ATmega16U2 (rev3 UNO)

« Last Edit: May 20, 2012, 03:09:06 am by TT » Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 197
Posts: 12739
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Now when opening the HEX I get an error "Address is out of range."

Someone else will have to help with that error.  It is outside of my experience.
Logged

Estonia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Still thanks for the quick response!
Got me one step closer to getting my Arduino working again.

Update: I toyed around with the buffer settings and now managed to get it working. For some reason it didn't adjust the Flash buffer range before.

It seems as if the HEX gets uploaded nicely. But after replugging the arduino it is still acting as an HID device.


« Last Edit: May 20, 2012, 04:02:01 am by TT » Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 473
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try this:

http://www.gammon.com.au/forum/?id=11638

I just put that file (Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex) onto an SD card an verified it against my Uno USB chip, without errors. So the file is OK.

You should be able to follow the wiring on that page (and get the SD card, heh) and re-flash the USB chip.

Code:
Atmega hex file uploader.
Written by Nick Gammon.
Version 1.9
Reading SD card ...

HEX files in root directory:

FOO.HEX       :       2915 bytes.
ARDUIN~1.HEX  :      20907 bytes.  Created: 2012-05-17 16:16:06.  Modified: 2012-05-17 16:16:06


--------- Starting ---------

Attempting to enter programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x94 0x89
Processor = ATmega16U2
Flash memory size = 16384 bytes.
LFuse = 0xEF
HFuse = 0xD9
EFuse = 0xF4
Lock byte = 0xCF
Clock calibration = 0x8B
Actions:
 [E] erase flash
 [F] modify fuses
 [L] list directory
 [R] read from flash (save to disk)
 [V] verify flash (compare to disk)
 [W] write to flash (read from disk)
Enter action:

V

Choose disk file [  ] ...

ARDUIN~1.HEX

Processing file: ARDUIN~1.HEX
Checking file ...

############
Lowest address  = 0x0
Highest address = 0x3D33
Bytes to write  = 7414
No bootloader.
Suggest making high fuse = 0xD9
Attempting to enter programming mode ...
Entered programming mode OK.
Processing file: ARDUIN~1.HEX
Verifying flash ...

##########################################################
No errors found.
« Last Edit: May 20, 2012, 04:24:17 am by Nick Gammon » Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 473
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It seems as if the HEX gets uploaded nicely. But after replugging the arduino it is still acting as an HID device.

Try rebooting the PC. I've heard some crazy tales about Windows and caching USB info.
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 473
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Or, uninstalling the device driver and reinstalling.

Ah, Windows!
Logged

Estonia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Try rebooting the PC. I've heard some crazy tales about Windows and caching USB info.
Quote
Ah, Windows!

Hehe, good advice actually. "Have you tried turning it on and off again"

Tried the reboot but still no change. I also have a mac nearby and its still acting as a mouse there aswell...

Unfortunately I don't have an SD card module and they are not that freely available here smiley-sad But the deadline for this project is within a few days so I'll have to find some other method..  I do have another UNO at home. Might be worth trying if i can flash the bootloader that way.

But if possible I'd prefer to get it working just using the Flip software. Can't be that hard?  smiley
« Last Edit: May 20, 2012, 04:25:28 am by TT » Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 473
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well two things I noticed ...

  • The signature reported in your image doesn't agree with mine (0x1E 0x94 0x89)
  • The file size (either on disk or as bytes to be changed) doesn't agree with mine (File: 20907 bytes ... Bytes to write  = 7414)

So something fishy is going on.
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 473
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The file I used was:

https://raw.github.com/arduino/Arduino/master/hardware/arduino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex

Code:
MD5 (Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex) = 374845d004d03c6ca0535bb4b6f19235
Logged

Estonia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Darn, getting that Address is out of range error again..
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 473
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't use that Atmel software. Use something crafted by the Arduino community. smiley-wink
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 473
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Show us your MD5 sum of the file you have.
Logged

Global Moderator
Online Online
Brattain Member
*****
Karma: 473
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Places to grab MD5:

http://etree.org/cgi-bin/counter.cgi/software/md5sum.exe eb574b236133e60c989c6f472f07827b
http://www.fourmilab.ch/md5/md5.zip b14e189e965e5ed523282d3c8ee6c945

« Last Edit: May 20, 2012, 04:48:45 am by Nick Gammon » Logged

Pages: [1] 2   Go Up
Jump to: