cancel
Showing results for 
Search instead for 
Did you mean: 

Can I have DFU and CDC printf on the same usb port?

WSpar.1
Associate III

I want to do both firmware updating via dfu and have serial data output on the STM32G431KB without having to press any boot switch or changing usb ports.

In my code I can probably jump to the bootloader, without having to pull high boot0 pin.

But can I also print out printf() lines over the same usb port to my host computer without an extra usb connector and/or FTDI chip?

8 REPLIES 8
TDK
Guru

You cannot have it operate in both modes at once, but you can jump to the bootloader when you need to, as you said.

Jumping to the bootloader is something you’ll need to initiate.

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

Sorry my questions was a bit confusing.

I didn't mean printing out data while in bootloader mode.

When I run my code I can use the exact same schematics and usb connector to send printf() data to my host pc?

Yes! No hardware change. The usb dfu has some external crystal timing requirements on some chips. Not sure about yours.
If you feel a post has answered your question, please click "Accept as Solution".
WSpar.1
Associate III

Do you know any good schematics example? All the nucleo boards use st-link so that is not a good reference

Don’t most nucleo-144 boards have the usb hooked up at the bottom of the board? You’d need to put it into bootloader mode to test, but I’m sure there is a jumper or solder bridge to facilitate that. I dont see how having st-link hooked up affects things. I’m not super familiar with the G4 series so it’s possible I’m missing something. The F4 and H7 certainly work this way.

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

Thanks for the tip. I was looking at NUCLEO-G431KB board and it doesn't have an extra OTG USB port, but the chip supports DFU and OTG. So I will take nucleo144 board as an example

WSpar.1
Associate III

Can I use the boot0 pin as a general I/O pin once my program is running?

Boot0 no, boot1 yes (if present).
If you feel a post has answered your question, please click "Accept as Solution".