cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to get Nucleo-F042K6 into DFU mode

AKrup
Associate II

I'm developing an application for the F042 series chips. I'm using Nucleo-F042K6 for development.

I want to allow users to flush firmware using DFU mode. I am unclear on how to force the device into the DFU bootloader. Some material I read suggests that the board is wired so that I only need to connect USB to PA10, PA11, VIN and GND and it goes into bootloader. Other sources suggest I need a 1.5k pullup on PA11. I must be missing something very simple. With just the USB connections, nothing happens when I plug USB in. With a pullup to DM, the host attempts enumeration, but gets no response from the chip.

On a Linux host, this the output from dmesg:

[945270.896795] usb 1-9: new full-speed USB device number 84 using xhci_hcd
[945271.024788] usb 1-9: device descriptor read/64, error -71
[945271.260797] usb 1-9: device descriptor read/64, error -71
[945271.496748] usb 1-9: new full-speed USB device number 85 using xhci_hcd
[945271.624734] usb 1-9: device descriptor read/64, error -71
[945271.860727] usb 1-9: device descriptor read/64, error -71
[945271.968716] usb usb1-port9: attempt power cycle
[945272.620662] usb 1-9: new full-speed USB device number 86 using xhci_hcd
[945272.620891] usb 1-9: Device not responding to setup address.
[945272.828796] usb 1-9: Device not responding to setup address.
[945273.036615] usb 1-9: device not accepting address 86, error -71
[945273.164584] usb 1-9: new full-speed USB device number 87 using xhci_hcd
[945273.164776] usb 1-9: Device not responding to setup address.
[945273.372685] usb 1-9: Device not responding to setup address.
[945273.580574] usb 1-9: device not accepting address 87, error -71
[945273.580671] usb usb1-port9: unable to enumerate USB device

5 REPLIES 5

Make sure PA10/PA11 don't conflict with anything else. AN2606 related to F4, or F402 specifically should be reasonably clear about pull-up, and state of BOOT0 pins. BOOT0 needs to be HIGH.

Review the manual/schematic.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
AKrup
Associate II

I can't spell. The chip is F042, not F402. I've edited the question to show correct designation.

Ah! Yes. BOOT0 is pulled to ground through a 10k resistor. That's what I've been missing. So oo I need a switch on BOOT0, or can I wire to VDD permanently? In my use case, users would only connect to USB for firmware upgrades.

Thank you, Clive. You ARE "that guy!"

I rewired BOOT0 high and now USB enumerates properly without any pullups.

So now how do I get it back out of DFU mode when I'm done writing a new binary? I'd like to write new firmware, launch the application and run it through some regression tests without having to connect/disconnect BOOT0. I do this now with STLINK. Can I do that with DFU? I use dfu-util. Its documentation[1] mentions a "leave" option that is supposed to reset the device, but it has no visible effect. If the device is resetting, it may be coming up again in DFU mode (BOOT0 is still tied to VDD) and just waiting for the PC to program it again.

[1] http://dfu-util.sourceforge.net/dfuse.html