cancel
Showing results for 
Search instead for 
Did you mean: 

DFU boot into NUCLEO-G431KB board.

WSpar.1
Associate III

I'm planning to build a custom board with the STM32G431KB on it and it needs to be programmed via USB.

So I bought NUCLEO-G431KB board and soldered a USB cable on it.

  • Red on Vin
  • Black on GND
  • White on PA11 USB_DM
  • Green on PA12 USB_DP

I also hooked PB8-boot to 3.3V when I plug the USB cable in

In Cube Programmer it doesn't show up in the DFU list.

I also don't hear the usb in/out sound on Windows.

PB8 also has a LD2 led hooked to it pulled low with a pull down.

In the DFU documentation they talk about different stuf f that has to be configured right, USB active, HSI, etc. But a bootloader is always using default config right?

In my opinion all the stuff I set in the .ioc file is for flash memory after you left the bootloader?

Am I doing something fundamentally wrong here?

I know the soldered USB cable will not have proper differential pairs, but out of a 100 resets I was hoping at least one DFU detect would succeed so I can continue my schematic.

DFU on the Nucleo 144 board that has a proper soldered DFU socket works.

So I assume it is my setup on the Nucleo 32 board, not CubeProgrammer or driver

8 REPLIES 8
TDK
Guru

The USB DFU bootloader requires a stable clock, typically provided by the HSE or an external clock source. You can find these details in "1 Bootloader code sequence" in AN3156.

https://www.st.com/resource/en/application_note/cd00264379-usb-dfu-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf

By default, this board has no clock input on PF0. You'll need to close SB13 in order to use the 8MHz clock output by the ST-Link chip.

0693W000000V7CLQA0.png

If you feel a post has answered your question, please click "Accept as Solution".
TDK
Guru

USB also has some timing requirements for 12 MHz signals (full speed), but even with soldered on wires you'll probably be okay.

If you feel a post has answered your question, please click "Accept as Solution".
WSpar.1
Associate III

No luck so far.

  • I first soldered SB9 and SB10, but then I realized this is 24MHz.
  • De-soldered SB9 & SB10 and soldered SB13
  • Connected st-link usb to get power and clock
  • Set PB0 high and hit reset button
  • No DFU detect

When I pullup USB_DP line I here the Windows 10 USB connect sound but get a warning it has not properly recognize the device

Then I tried to add a voltage divider 10k/69k to PA9 (not sure of this is the right pin though)

Do I have to set something in my .ioc file? Maybe activate USB?

Or specific clock settings?

WSpar.1
Associate III

Ok I got something going.

When I connect via ST-link I discovered that option byte nSWBOOT0 was unchecked and never was listening to PB8-boot.

Is this unchecked by default? In that case I can never DFU bootload a factory fresh microcontroller.

Or is it unchecked when once you manage to connect via ST-Link before?

WSpar.1
Associate III

Does any one know what the default factory values are of the option bytes?

Uwe Bonnes
Principal III

Try to decipher from the reference manual. Succes may vary. I wish, stm32cubeprogrammer had an option to reset to the default values...

TDK
Guru

It's not a mystery. Values are right there in the reference manual:

For example:

> User and read protection option bytes

> Flash memory address: 0x1FFF 7800

> ST production value: 0xFFEF F8AA

If you feel a post has answered your question, please click "Accept as Solution".
WSpar.1
Associate III

Thanks for mentioning the Rerence manual.

Coming from Atmel controllers, everything is inside the datasheet.

I knew I was missing so much register information in the ST datasheet of the STM32G431KB

So in general ST bundles all overlapping information of the MCU series in the Reference manual?

So luckily all controllers are bootable from pin PB0 clean from factory. (ST production value: 0xFFEF F8AA)

Some ST circuits use PA9 for USB vbus detection via a voltage divider

But I don't think the G4 series has that?

I would expect that information inside the datasheet but nothing special is mentioned on PA9 if I search.

In AN2606 they put: Note: VDDUSB IO must be connected to 3.3 V for USB to be operational

Searching on "VDDUSB" inside Reference manual and datasheet gives 0 results.

I think I'm missing the ST way of thinking, a lot of stuff is named differently between documents.

I would like to hear the workflow of experienced embedded engineers 🙂