2
\$\begingroup\$

I would like to program a custom board based on STM32F446RET MCU by using the default STM32 USB DFU bootloader. I did the following connections:

  • board VCC to USB cable and VBUS_FS
  • board GND to USB cable
  • UDB_DP to USB cable
  • USB_DN to USB cable

When reset BOOT0=3.3V and BOOT1=GND

The MCU seems to enter in the bootloader (the main program does not start) but STM32Programmer is not able to connect to the USB device

Am I missing something?

EDIT 1:

The circuit is very close to this one:

Schematic of the described circuit

EDIT 2:

I discovered the source of the problem, but not the solution. Here's more details. There is a USB A receptacle on the board and:

  • if I use a USB-A to USB-A cable to connect the board to the PC everything works.
  • if I use a USB-A to USB-C cable to connect the board to the PC it does not work.
  • if I use two cable adapters: USB-A to USB-A (male) and USB-A (female) to USB C, it works

It seems like that when USB C is used we need an additional circuit (the same that it is inside the cable adapter). Which circuit? I'm not able to find anything on the internet

\$\endgroup\$
12
  • \$\begingroup\$ Yes. But we don't know what you are missing. Please provide schematics and wiring info how you connected things. We don't know which board it is and does it allow DFU. \$\endgroup\$
    – Justme
    Jul 31, 2023 at 14:39
  • \$\begingroup\$ Thank you! This is a custom board. Unfortunately I cannot provide the schematic but I think that the relevant connections are reported above \$\endgroup\$
    – Damien
    Jul 31, 2023 at 15:22
  • \$\begingroup\$ Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. \$\endgroup\$
    – Community Bot
    Jul 31, 2023 at 15:41
  • \$\begingroup\$ @Damien No, certainly the relevant connections are not reported above. Even if the MCU enters bootloader, it might not enter DFU mode if it enters accidentally to some other mode due to your connections, or if it does enter DFU mode, it might not have a proper clock source for DFU to work due to your connections. \$\endgroup\$
    – Justme
    Jul 31, 2023 at 16:28
  • 2
    \$\begingroup\$ @Damien Wait; your device has Type-A receptacle like a PC? Your device should have Type-A plug or Type-B receptacle if it is not a host. That is why no standard adapter works. I think I can provide an answer now. \$\endgroup\$
    – Justme
    Aug 7, 2023 at 6:55

1 Answer 1

3
\$\begingroup\$

You are trying to connect incompatible connections together.

I don't know why your device has a Type-A receptacle, but it is reserved for USB hosts only. Maybe you want to plug in a USB storage device when the STM32 is a host. So it might be correct for normal use.

But when programming, the STM32 is a USB device, not a host.

USB cables with Type-C plug on one end and Type-A plug on the other are meant to connect a Type-A host with receptacle to a Type-C device with receptacle. The Type-C plug identifies as the host side, so if you plug it into a laptop, it will not work.

So the correct cable for connecting a PC to device will have a Type-C plug and Type-A receptacle, and the Type-C plug identifies itself as device to the PC.

The next problem is, you need an illegal USB cable with Type-A plugs on both ends.

This kind of cable should not exist as it will allow two hosts to be connected togther and it will short their power supplies. Unfortunately these cables exist, as many devices have incorrectly used a Type-A receptacle.

Fortunately, USB3 specs allow existence of such a cable for debugging use, but only if it omits the VBUS supply connection, so these are safe to use.

So, if you need the PC to power the STM32 board, you need an illegal cable which do exist and are available, but you might also end up with the legal cable which omits the supply connection, you need to power the STM32 board externally. Or make a DIY custom cable for programming.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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