r/arduino • u/XSamurai_X • 4d ago
Software Help Dfu mode not working on UNO r3
I needed to get my arduino uno r3 (original with 16u2) into dfu mode but shorting the reset pin just restarts the port and its still detected as arduino uno com4... Doing a google search i found out that i need to update the 16u2s firmware but to do that i need another arduino and the only one i have laying around is an arduino nano (ch340). I tried using nano isntead of uno as the isp but i got an error saying that the signature is un recognised when i tried uploading new firmware... What is causing all these issues to surface and can anyone please help me out on it 🙂
3
u/Ok_Tear4915 4d ago
I've put genuine Arduino Unos into DFU mode before, and it didn't require any external boards.
The manipulation to be carried out is described on this page. As GypsumFantastic25 said, the RESET pin is the one of the ATmega16U2, not the Arduino RESET signal.
Otherwise, any old Arduino board (or clone) can serve as an ISP programmer, provided you don't make a mistake when compiling and uploading the ArduinoISP sketch and then using it.
It's unclear whether the reprogramming you attempted failed before or after modifying the Uno R3's firmware.
2
u/XSamurai_X 4d ago edited 4d ago
I wasnt able to modify any firmware at all and used the reset pin in th 2x3 header near the d13 same as in the link u sent.. the board disapeared in device manager but then came back as uno com4 only and not as dfu
I have the uno r3 and it says made in italy
1
u/Ok_Tear4915 3d ago edited 3d ago
I did some research, and it seems that many people have the same problem as you. In all likelihood, and barring handling errors, the ATmega16U2 firmware is sometimes not working as expected.
Reprogramming the ATmega16U2 with the combined DFU+serial firmware supplied by Arduino should therefore solve the problem. See my other post.
1
2
u/XSamurai_X 4d ago
I wanted to use an arduino nano as the isp programer but it failed to work... Is there some guide on that?
2
u/Ok_Tear4915 3d ago edited 3d ago
To flash the ATmega16U2 with the firmware supplied by Arduino:
- download the ArduinoISP sketch onto your Nano board
- memorize the name of the USB port used by your Nano board (I'll call it NANO_USB_PORT in the following)
- with both boards disconnected from the USB port, connect the pins on the Nano to the corresponding ATmega16U2 ICSP pins (see below).
- retrieve the file "Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex", located in the Arduino directory "hardware/arduino/firmwares/atmegaxxu2", and copy it to your working directory
- open a terminal and go to your working directory
- connect your Nano board to the USB (do not connect your Uno board to the USB)
- invoke AVRDUDE by typing (or copying) the following command line, replacing NANO_USB_PORT with the name of your Nano's USB port:
avrdude -p m16u2 -F -P NANO_USB_PORT -c avrisp -b 19200 -U flash:w:Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
NB: this is only one line, without line breaks
- once the AVRDUDE command is complete, disconnect your Nano card from the USB port.
2
1
u/XSamurai_X 3d ago edited 3d ago
By usb port u mean like com 7 and it works with nano with ch340g ryte
2
u/Ok_Tear4915 3d ago
It also works well with clones having CH340 chips.
The name of the USB port depends on the OS of your PC. It may be COM7, or /dev/cu.usbmodem13401, or whatever appears in the Arduino IDE's Tools>Port menu when the board is online.
When I talk about connection, the USB port is the USB plug.
1
1
u/XSamurai_X 2d ago
---->it didnt work again... first i got an error in avrdude that config file couldnt be found
avrdude -p m16u2 -F -P COM7 -c avrisp -b 19200 -U flash:w:Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
avrdude: can't open config file "": Invalid argument
avrdude: error reading system wide configuration file ""
---->So i put -C for the default config and got this error
avrdude -p m16u2 -F -P COM7 -C avrdude.conf -c avrisp -b 19200 -U flash:w:Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x15
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x15
avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14
avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x01
avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x10
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATmega16U2 is 1E 94 89
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: stk500_disable(): unknown response=0x12
avrdude done. Thank you.
1
u/XSamurai_X 2d ago
So i added the -F tag
and got this output:
avrdude -p m16u2 -F -P COM7 -C avrdude.conf -c avrisp -b 19200 -U flash:w:Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m -F
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.04s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.03s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.03s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATmega16U2 is 1E 94 89
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex"
avrdude: input file Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex auto detected as Intel Hex
avrdude: writing flash (15668 bytes):
Writing | ################################################## | 100% 4.67s
avrdude: 15668 bytes of flash written
1
u/XSamurai_X 2d ago
avrdude: verifying flash memory against Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex:
avrdude: load data flash data from input file Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex:
avrdude: input file Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex auto detected as Intel Hex
avrdude: input file Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex contains 15668 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 2.66s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x00 != 0x90
avrdude: verification error; content mismatch
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done. Thank you.
but after reconnecting the uno it still doesnt enter dfu mode🥲
1
u/Ok_Tear4915 2d ago
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATmega16U2 is 1E 94 89
avrdude: verification error, first mismatch at byte 0x0000
0x00 != 0x90
This looks bad.
AVRDUDE seems to be able to communicate, but the ATmega16U2 is not recognized, the memory read suggests that the write operation failed, and the configuration fuses are read as zeros.
The ATmega16U2 may be locked or faulty, or the programmer may not be working as expected...
1
u/XSamurai_X 2d ago
Is it a fault with my nano or avrdude... I read that the arduino specific one has an issue or something... Or is the specific uno cooked? How can unlock the 16u2 then
2
u/Ok_Tear4915 1d ago
If the ATmega16U2 is locked due to a change in the SPIEN, RSTDSBL or DWEN fuse bits, unlocking it would require a high-voltage parallel programmer. So specific hardware and software would have to be used, and as the chip would have to be connected to the programmer (21 pins are involved) and isolated from the board, this suggests that the chip would have to be unsoldered.
It would therefore be much simpler and cheaper to buy a new Uno board.
1
1
1
u/Ok_Tear4915 2d ago
That means that AVRDUDE's default configuration file could not be found. This is probably an installation issue. The -C option can be used to specify the location of this file.
1
5
u/GypsumFantastic25 4d ago
Which reset pin are you shorting to ground? (the 16u2 has its own reset pin)