1

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

Damien
  • 113
  • 4
  • 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. – Justme Jul 31 '23 at 14:39
  • Thank you! This is a custom board. Unfortunately I cannot provide the schematic but I think that the relevant connections are reported above – Damien Jul 31 '23 at 15:22
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jul 31 '23 at 15:41
  • @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. – Justme Jul 31 '23 at 16:28
  • Thank you @Justme! I edited the question by adding the schematic that I used without the parts that I can not post – Damien Aug 01 '23 at 06:48
  • Didn't use USB, but i've had an issue with UART. Programmer said "no device found" until I disconnected the device from MCU SPI pins. – Morris Aug 01 '23 at 06:55
  • @Damien Like I said, that schematic should work, but due to the connections that you can't show, these connections can prevent bootloader from working, or, the crystal does not work. The only thing specifically not suggested is the pull-up on reset, but it does not prevent it from working. – Justme Aug 01 '23 at 08:41
  • Maybe I missed a very important info. The board is attached to the "programmer device" with USB-C. I mean: the board has a USB A receptacle, while the external device has USB-C. The board and the device are connected with a USB-A to USB-C cable. I noticed that the USB cable does not output 5V (maybe because of the USB-C standard?). Do I need some extra power negotation circuit? – Damien Aug 04 '23 at 06:49
  • @Damien It is a common mistake to change a Type A receptacle to Type C receptacle on a USB device and forget to connect the pins that allow the host to detect the device. So if your device has Type A as in the provided schematics, your device is made correctly and the problem is elsewhere. It should work so most likely problem is in the "programming device". Is that something you made? – Justme Aug 07 '23 at 06:36
  • The programming device is a PC with STM32cube programmer. But I would like to use the USB-C port of the PC (with the USB A it works) – Damien Aug 07 '23 at 06:38
  • 2
    @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. – Justme Aug 07 '23 at 06:55
  • Exactly! That makes a lot of sense! Thank you very much @Justme!! – Damien Aug 07 '23 at 07:01

1 Answers1

3

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.

Justme
  • 127,425
  • 3
  • 97
  • 261