Go Down

Topic: How to get USB-Serial hex back to Arduino UNO Rev3 / solved (Read 6093 times) previous topic - next topic

TT

May 20, 2012, 08:57 am Last Edit: May 20, 2012, 06:25 pm by TT Reason: 1
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?

Coding Badly

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

TT

#2
May 20, 2012, 09:43 am Last Edit: May 20, 2012, 10:09 am by TT Reason: 1
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)


Coding Badly

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.

TT

#4
May 20, 2012, 10:40 am Last Edit: May 20, 2012, 11:02 am by TT Reason: 1
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.



Nick Gammon

#5
May 20, 2012, 11:08 am Last Edit: May 20, 2012, 11:24 am by Nick Gammon Reason: 1
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: [Select]
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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon


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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

Or, uninstalling the device driver and reinstalling.

Ah, Windows!
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

TT

#8
May 20, 2012, 11:23 am Last Edit: May 20, 2012, 11:25 am by TT Reason: 1
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 :( 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?  :)

Nick Gammon

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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

The file I used was:

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

Code: [Select]
MD5 (Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex) = 374845d004d03c6ca0535bb4b6f19235
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

TT

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

Nick Gammon

Don't use that Atmel software. Use something crafted by the Arduino community. ;)
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

#14
May 20, 2012, 11:43 am Last Edit: May 20, 2012, 11:48 am by Nick Gammon Reason: 1
Places to grab MD5:

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

Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up