2020-03-31 10:18 AM
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.
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
2020-03-31 07:57 PM
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.
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.
2020-03-31 08:00 PM
USB also has some timing requirements for 12 MHz signals (full speed), but even with soldered on wires you'll probably be okay.
2020-04-01 09:31 AM
No luck so far.
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?
2020-04-01 11:24 AM
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?
2020-04-02 08:21 AM
Does any one know what the default factory values are of the option bytes?
2020-04-02 08:37 AM
Try to decipher from the reference manual. Succes may vary. I wish, stm32cubeprogrammer had an option to reset to the default values...
2020-04-02 08:40 AM
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
2020-04-02 09:40 AM
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 🙂