Electronic – arduino – ATMega8U2 and DFU mode

arduinoatmegafuse-bitsusb

I made simple board with ATMega8U2 microcontroller for my USB experimenting (I'd like to make MIDI, HID, … devices). I took inspiration in Arduino Uno. If you look on schematic below, you can see it is almost the same as Uno.

I programmed 8U2 with firmware from Arduino project — UNO-dfu_and_usbserial_combined.hex. Now, if I connect board to USB, I get serial port and it works just like Arduino, so this is perfectly OK.

My problem is: how can I put 8U2 into DFU mode, so I can change firmware without external programmer? If you look on picture, I connected HWB (pin PD7) to ground, so it should be simple — just pressing reset button. Unfortunately, it isn't working.

Am I missing something? Can be a problem in wrong fuse bites?

Edit: My fuses are lfuse=0xff hfuse=0xd9 efuse=0xf4

Edit2:

I checked fuses on chip

$ avrdude -p at90usb82 -P /dev/tty.usbmodem411 \
> -F -c arduino \
> -U lfuse:r:low:h \
> -U hfuse:r:high:h
$ cat high low
0x00
0x00

For programing, I'm using Arduino Uno as ISP and this commant (on Mac):

$ avrdude -p at90usb82 -F -P /dev/tty.usbmodem411 \
> -c arduino \
> -U flash:w:UNO-dfu_and_usbserial_combined.hex \
> -U lfuse:w:0xFF:m \
> -U hfuse:w:0xD9:m \
> -U efuse:w:0xF4:m \
> -U lock:w:0x0F:m
.......
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
  0xff != 0x00
avrdude: verification error; content mismatch

So I suppose, avrdude did not programed fuses and they are still blank. Is it possible? Because board is working corrently, except DFU mode after reset.

Schematic ATMega8U2

Best Answer

Is the HWBE bit (HardWare Boot Enable) set in your fuses?