Could a USBasp help me fix my messed up 16U2? - Page 1
Forum section: electronics / general

author: dentaku
author_rank: Frequent Contributor
timestamp: August 21, 2015, 04:15:36 pm
content: I have a Arduino UNO R3 clone from Sintron with a 328P-PU and a ATmega16U2.The 328 is working fine because the last sketch I programmed on it still works. The 16U2 seems to me messed up because I can't make it enter DFU mode to even start attempting to fix it and it just keeps identifying itself as Arduino Uno (Com3) no matter what I do.I can't upload anything to the UNO anymore, I don't own a programmer of any sort and I don't have another Arduino I could use with the Arduino as ISP sketch.QUESTIONS:- If I get a USBasp with a 6pin connector (I can probably make my own adapter) and connect it to the 6 pin header next to the USB port will it help me try to fix the 16U2 with either AVRDude or Flip?- If the 16U2 IS unfixable, I see that the USBasp shows up in the list of official programmers the Arduino IDE supports (I prefer Atmel Studio6 though) so at least I can use the USBasp to program this otherwise useless UNO by connecting it to the 6pin header on the right edge of the UNO?- Is there a better inexpensive tool than the USBasp I would needI've done the loopback test and nothing echoes back.I'm sure the Arduino shows up in Device Manager on COM3 and goes away if I unplug it.The IDE is set to Board:UNO and Port: COM3.I updated from 1.6.0 to 1.6.5Tried it on both my Win7 computer and an old WinXP laptop.Tried it with Atmel Studio / Visual Micro.There's nothing connected to pins 0 or 1 (or any pins at the moment).A new USB cable didn't help

author: Tainer
author_rank: Contributor
timestamp: August 23, 2015, 09:05:43 am
content: Never used an arduino, but I'll try to help.Quote from: dentaku on August 21, 2015, 04:15:36 pmDo you mean it's a board with atmega328 as the main microcontroller and atmega16 used as UART-USB converter? I would suggest sending some random bytes via terminal and probing TX line with a logic analyzer or a scope. If you have none of these tools then set your meter to volts and send a very long string of characters over COM3 - you will notice some change if it's transmitting. If it's working fine, then it might be a bad connection between the two microcontrollers - try reseating your 328 (it's usually socketed on arduino boards) and check solder joints.Quote from: dentaku on August 21, 2015, 04:15:36 pmYou could buy a cheap uart-usb converter board (FTDI, CP210x, etc) and use it as a bit-bang programmer. If you have an old PC with LPT port then you already have a programmer(google 'AVR LPT programmer').

author: ralphd
author_rank: Frequent Contributor
timestamp: August 23, 2015, 01:42:26 pm
content: Your plan sounds reasonable.A usbasp is <$2 on Aliexpress, or for about $2.5 you could get a pro mini and USB-ttl adapter, and run the ArduinoISP sketch on the pro mini.If you are going to do work on AVRs, I'd suggest getting both. I have a couple different USBasps and several USB-ttl adapters.

author: dentaku
author_rank: Frequent Contributor
timestamp: August 24, 2015, 10:31:05 am
content: Quote from: ralphd on August 23, 2015, 01:42:26 pmI'm going to get ahttp://www.dipmicro.com/store/USBASP2and a $2http://www.dipmicro.com/store/PL2303HX-MODordered from Canada so I don't need to wait for them to come from China.

author: dentaku
author_rank: Frequent Contributor
timestamp: August 29, 2015, 02:46:17 am
content: I got a USB-TTL adapter and it shows up fine as COM5. I opened up Teraterm and the TX light blinks when I type characters.Question:Before messing with trying to fix the 16U2 (I also got a USBASP) I'd like to see if I can still program this UNO just using the TX/RX pins as you would with a Pro Mini or something that doesn't have it's own USB-TTL chip onboard.This adapter has 5 pins (3V3, TXD, RXD, GND, +5V and unfortunately no reset functionality). When programming an Arduino UNO with one of these what do I do with the +5V and GND?The RX goes to TX and the TX goes to RX, that's logical, but when programming an UNO that's already got it's own power source do I need the +5V and GND?What about having to hold down the Reset button when programming this way?

author: retrolefty
author_rank: Super Contributor
timestamp: August 29, 2015, 02:53:22 am
content: Quote from: dentaku on August 29, 2015, 02:46:17 am

author: dentaku
author_rank: Frequent Contributor
timestamp: August 29, 2015, 01:11:12 pm
content: Quote from: retrolefty on August 29, 2015, 02:53:22 amI used my scope and see that TX on the USB-TTL adapter is an output that is normally High and goes Low if I type characters into Teraterm so that works as an output as expected.Which +5V on the UNO do you mean? I've always thought of the 5V pin (next to GND, GND) as just an output connected to the regulator but can they be used to also power the UNO if it doesn't have any other source of power connected to it?The official site says this-5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it.It's not that I have any problems using a +9V DC plug to power it it's just that it would be easier to use the +5V from the USB-TTL adapter.I've also never used the Vin (9V) and IOREF pins before but I guess that's a subject for another post.

author: ralphd
author_rank: Frequent Contributor
timestamp: August 29, 2015, 01:56:30 pm
content: Quote from: dentaku on August 29, 2015, 02:46:17 amYou could try my zero-wire auto-reset technique.http://nerdralph.blogspot.ca/2014/02/zero-wire-serial-auto-reset-for-arduino.htmlOr use your usbasp to flash picobootSTK500, which uses reset to toggle the bootloader mode where it just waits for the code to flash.http://nerdralph.blogspot.ca/2015/06/picobootstk500-v1-release.html

author: dentaku
author_rank: Frequent Contributor
timestamp: August 29, 2015, 05:01:15 pm
content: Well... As I knew from the start, this UNO works fine because it was running the sketch that was last put on it before the 16U2 messed up and just now I plugged a 9V adapter into the barrel jack, connected the GND, TX and RX of the USB-TTL adapter to the correct headers, held down the RESET button as the sketch compiled and let go when it said Uploading and I managed to program the Blink sketch into it.I also tried it with AVRStudio and it works well too.I guess now the next step is to find out if my new USBASP works, learn how to use it and to try to put a new .hex file in the 16U2.The place I got it from says thishttps://www.dipmicro.com/store/USBASP2This programmer is intended to be used with Windows GUI based ProgISP 1.72.If you prefer to reprogram it to use with AVRDUDE, please read this article. You will need second AVR programmer for this. If you prefer this version, we can reprogram your programmer at no charge, just leave a note with your order that you want us to reflash it.NOTE: when using with AVRDUDE, you may need to specify -B 10 option to set the clock otherwise AVRDUDE may fail.Command line to reprogram this programmer to USBASP:avrdude.exe -p m8 -c usbasp -P usb -U flash:w:"20130212_mega8_usbisp.hex":a -U lfuse:w:0xef:m -U hfuse:w:0xc9 -FI don't mind using ProgISP 1.7.2 if it lets me re-flash the 16U2. As long as it works, that's OK.I left a note with my order to have them reflash it but I haven't checked to see if it was done. I guess first I need to find out how to check if it was done or not

author: dentaku
author_rank: Frequent Contributor
timestamp: August 29, 2015, 06:22:07 pm
content: Well, the USBasp I got seems like it was reflashed by the people I bought it from because it shows up in Device Manager as USBasp, it failed to install drivers like it' supposed to so I pointed it to the folder I downloaded the libusb_1.2.4.0 drivers to and it looks like it's OK.I believe the .HEX file I'm looking for to try and fix the 16U2 is C:\Program Files (x86)\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2\arduino-usbserial\Arduino-usbserial-atmega16u2-Uno-Rev3.hexOr do I want C:\Program Files (x86)\Arduino\hardware\arduino\avr\firmwares\atmegaxxu2\Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3If the 16U2 is unrecoverable at least I can just keep using it with the USB-TTL adapter because it works fine that way.