Skip to main content
NBurc
Associate
February 27, 2019
Question

USB DFU not working on bare metal stm32. Not showing the MCU via usb

  • February 27, 2019
  • 11 replies
  • 7208 views

0690X000006DtnNQAS.pngHi,

I can not get DFU to work in the schematic shown.

I am attempting to enter DFU mode but I can't see any devices in Win 7.

I don't know if this is a USB issue or DFU mode issue.

I would appreciate any help.

Best

Nick

This topic has been closed for replies.

11 replies

Mon2
Senior III
February 28, 2019

For your package of the CPU, review the location and use of the BOOT0 pin which is required to invoke the use of the USB DFU.

Review the following as a good read:

https://robo.fish/wiki/index.php?title=Programming_STM32F042

Download and install STM DFuse:

https://www.st.com/en/development-tools/stsw-stm32080.html

Once you satisfy the condition for BOOT0 (and perhaps BOOT1 if applied on this CPU) AND pulse #RESET, then the USB DFU will boot.

Post back with your update.

Tesla DeLorean
Guru
February 28, 2019

Are we sure the part in question supports DFU in ROM. How large is the ROM?​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
NBurc
NBurcAuthor
Associate
February 28, 2019

Hi, I have done as Mon2 says, double checked everything and unfortunately I can't get it to work. I think its must be a schematic issue which I am trying to solve now.

Clive - The DFU for this part is in ROM - at least it says so in the STM32F042K6 datasheet.

Ben K
Senior III
February 28, 2019

This part actually boots in DFU mode also if there is no valid program in flash (at least it does for the TSSOP20 version, which doesn't have BOOT0 pin). The serial resistors are not needed on the USB lines, try to see if changing them to 0R fixes the issue.

Tesla DeLorean
Guru
February 28, 2019

Thanks for the confirmation Ben​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Mon2
Senior III
February 28, 2019

Also, USB typically demands impedance controlled traces for the USB lines between the USB connector and the USB CPU pins. About 90 ohms. Was this done?

Concerned also about P1 being mated with the USB connector which is usually not recommended unless special care was taken on the PCB layout as this will throw off the USB line impedance. There are many notes on how USB layout should be performed for best results.

However, you may be still ok here as the USB boot loader operates at 12 Mbps (FS) and not HS (480 Mbps) so you may be able to get this to still function yet. However, you may also face flaky results due to these flyers of the USB traces.

To confirm, you are strapping BOOT0 to a logic HIGH and then power cycling the board for a proper RESET of the CPU?

Is the USB cable being used "fully loaded" that offers the D+ / D- lines? If in doubt, grab another and test again. We have been stung with some garbage "charge ONLY" cables where only Vbus and Ground pins are present. Someone must have saved 5 cents somewhere, perhaps Lucy.

0690X000006DusJQAS.jpg

---

Update - why is PIN 4 floating? That is #RST for the CPU.

Does that pin not require a RC circuit for a power on reset?

R to +3v3

C to ground

Common to #RST pin 4.

Please confirm.

Tesla DeLorean
Guru
February 28, 2019

>>Does that pin not require a RC circuit for a power on reset?

Technically I don't think it does. I has an internal pull-up if I recall, and a POR circuit with minimal pulse-width attached via VDDA. People tend to use RC implementations to slow the rise of NRST

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
NBurc
NBurcAuthor
Associate
March 1, 2019

Hi,

I changed USB serial resistors to 0R. The pull up resistor for D+ is supposedly integrated internally into the chip, however the D+ is at 0V as well as D-.

I am putting BOOT0 high and resetting.

I checked different cables and checked them with other devices and picked the ones that work with other devices so this should not be an issue.

P1 is unconnected to a header but I am using it as test points. I thought for USB FS it will be enough as P1 is very close.

Regarding the NRST i left it unconnected as it has an internal pull up resistor.

Still can't get it to work...

I really appreciate all your help.

Mon2
Senior III
March 1, 2019

My suggestion,

1) Order one of these kits by ST which is fitted with the same CPU as you are using:

https://www.st.com/en/evaluation-tools/nucleo-f042k6.html

Also, a USB connector break out board:

https://www.adafruit.com/product/1833

  • could be any brand but we have used this one without issues for our DFU USB testing in the past

Arrow is awesome for such low cost boards and parts with free shipping across USA / Canada.

https://www.arrow.com/en/products/1833/adafruit-industries

https://www.arrow.com/en/products/nucleo-f042k6/stmicroelectronics

2) Using fly wiring, connect this USB connector onto PA11 / PA12 as you have done for your custom PCB.

3) Proceed to test the DFU USB boot loader once again by strapping BOOT0 HIGH and pulsing #RST.

Does that work for you?

Perhaps the CPU is blown or shorted and/or lacking power connections for some reason on your custom board so suggesting the above.

Otherwise, seek a priest for an exorcism of this project...

0690X000006DvKQQA0.png

Post back once you have tested with a known good board using the suggestions above.

Mon2
Senior III
March 1, 2019

@NBurc​ , what is the history of:

a) this CPU? was it sourced new and from a reliable vendor?

b) how was it soldered onto the PCB? by hand or through automated and qualified equipment and process?

c) is the CPU getting warm or hot to the touch?

d) is the CPU blank or has some code already in the flash?

You may be facing the same quirk as here:

https://community.st.com/s/question/0D50X0000ARQLq2SQH/has-anyone-gotten-the-boot0-pin-to-work-on-an-stm32g071

Tesla DeLorean
Guru
March 1, 2019

Does it need a crystal clock source?

Does USB work from a user application?​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Mon2
Senior III
March 1, 2019

I think we have one of these kits in the lab. Will try to review this asap and post back.