0
\$\begingroup\$

I have a atmega32u4 from factory with dfu inside. The HWB is pull down, and RESET pin is pull up.

The first USB plug, dfu programmer appears on my Linux box. I upload the firmware without problem. Now, every time I plug my atmega to USB the application runs first, instead of dfu. But, when reset mcu by software, the bootloader code runs.

According to datasheet, default fuses are : BOOTRST = 1 and HWBE = 0. With this fuses and signals, the expected behaviour should be always the first one as the image show.

Boot process datasheet

I don't know why reset by software, the bootloader runs.

\$\endgroup\$
0
\$\begingroup\$

After some testings, this is what happend. The startup code is:

*. At startup, check MCUSR. If reset was due to watchdog, clear corresponding flag.

*. Turn off wdt.

*. Configure wdt with desired timeout.

*. Feed the wdt when needed.

Two options are possible to start application with dfu-programmer:

  1. Start application with an internal hardware reset using watchdog.

  2. A jump at address 0x0000 without reset.

Hanging mcu later, if app was launched with option one, the applications boots.

Using option two, by some reason, the bootloader runs this time.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.