Skip to main content
Dat Tran
Senior II
December 3, 2024
Solved

STM32C0 bootloader interface

  • December 3, 2024
  • 13 replies
  • 2716 views

Hi everyone,

On STM32C0, PA9 and PA11 are same pin, need to enable/disable remap to switch between them.

Meaning if I enable PA9 then PA11 cannot be used.

Same issue for PA10 and PA12.

In STM32 Bootloader mode, STM32 can detect UART or USB mode on these pins at the same time, how do they do that?

If we config USB, using PA11 and PA12 then we cannot use PA9, PA10 for UART1. 

If we config UART then we cannot use PA11 and PA12 for USB.

We can detect start of frame or USB, if config these pins for USB, or receiving 0x7F for UART, if config these pins for UART.

But I can't find anyway to do UART and USB at the same time.

 

 

 

This topic has been closed for replies.
Best answer by mƎALLEm

From that organigram, if USART has not received a complete 0x7F byte from the host, USB will be executed no matter which GPIO is used.

13 replies

mƎALLEm
ST Technical Moderator
December 3, 2024

Hello,

What STM32C0 part number?

Did you check the AN2606?

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Dat Tran
Dat TranAuthor
Senior II
December 3, 2024

Thank you so much for response, 

I am using STM32C071xx.

I just check your link about AN2606, I see hardware requires but still not clear about how detect between USB, UART.

Can you please point out a little bit more?

Thank you so much!

 

 

 

 

gbm
Super User
December 3, 2024

There are two possible solutions. USB host has pulldowns on D+ and D- lines - possible to detect. Another idea: When the D+ pullup is activated by USB device, the host start the enumeration process. If this doesn't happen, bootloader may switch to UART (and back to USB).

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Dat Tran
Dat TranAuthor
Senior II
December 3, 2024

We thought about that, but I am not sure if this is the way STM does to auto detect USB and UART at the same time.

gbm
Super User
December 5, 2024

See above. USB host has pulldowns on data lines. I don't know how the bootloader detects USB, but checking for pulldowns seems to be an obvious option.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice