Skip to main content
Graduate
February 21, 2020
Question

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

  • February 21, 2020
  • 5 replies
  • 1434 views

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?

    This topic has been closed for replies.

    5 replies

    Super User
    February 21, 2020

    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.

    WSpar.1Author
    Graduate
    February 21, 2020

    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?

    Super User
    February 21, 2020
    Yes! No hardware change. The usb dfu has some external crystal timing requirements on some chips. Not sure about yours.
    WSpar.1Author
    Graduate
    February 21, 2020

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

    Super User
    February 21, 2020

    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.

    WSpar.1Author
    Graduate
    February 22, 2020

    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.1Author
    Graduate
    February 24, 2020

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

    Super User
    February 24, 2020
    Boot0 no, boot1 yes (if present).