cancel
Showing results for 
Search instead for 
Did you mean: 

STM32C0 bootloader interface

Dat Tran
Senior II

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.

 

 

 

12 REPLIES 12
gbm
Lead III

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

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.

That is not true or I am confused. 

From the organigram, if UART has not received 0x7F then check USB cable connection, if USB cable connection is not connected then back to check 0x7F, they are in loop.

My question is how to check USB cable connection if these pins are used by UART?

Your answer was, if has not received 0x7F then USB is executed. Does it will be back to UART in a loop? If not in a loop, then what is right time to send 0x7F? what is timeout? If you send 0x7F too late then USB will be executed, and I don't think this is in the organigram. And as test, I can connect the board to STM32CubeProgrammer, wait for 10 minutes, then select UART, click connect, UART still work, not USB.

 

From organigram, 0x7F will break the loop, I2C address will break the loop...USB Cable detected will break the loop

Again, how to implement "USB Cable detection"?

We are talking about small chip "UFQFPN28" where is PA9 and PA11 are same, PA10 and PA12 are same. 

Bigger chip where those pins are separated then we can initialize UART, USB at the same time just fine  and detect USB is not a problem to us.