2024-01-21 07:11 AM
According to AN4879, PA9 must be used as VBUS Sensing and must not be re-used for other purposes. However, according to CubeMX, PA9 refer to USART1_TX and USART1 is the only port that supports memory reprogramming (STM32F103VET6 Datasheet Section, 2.3.10, "Boot modes")
Does it mean that in self-powered devices, USART1 and USB must not be used simultaneously?
Solved! Go to Solution.
2024-01-21 07:37 AM - edited 2024-01-21 07:51 AM
The USB has to be powered down in order to use PA9 as something else:
If you boot into the bootloader, USB is not initialized and USART1 can be used with PA9. But within your program, if you have USB running, you can't use USART1 at the same time.
Edit: the above is what the reference manual says. CubeMX has no issue with using them both at once. I suspect the RM is correct but don't have a chip to test.
2024-01-21 07:37 AM - edited 2024-01-21 07:51 AM
The USB has to be powered down in order to use PA9 as something else:
If you boot into the bootloader, USB is not initialized and USART1 can be used with PA9. But within your program, if you have USB running, you can't use USART1 at the same time.
Edit: the above is what the reference manual says. CubeMX has no issue with using them both at once. I suspect the RM is correct but don't have a chip to test.
2024-01-21 10:06 AM
It's not necessary to use PA9 for VBUS sensing, you can use any other pin. However, you then have to modify the USB code accordingly.
JW
2024-01-21 10:55 AM
Hi @OW1TY2 ,
indeed on STM32F103 MCU, it is not necessary to use PA9 , any other pin can be re-used as GPIO with a resistor bridge to detect VBus (5 Volts) from USB Host . These series features only Device Mode Full speed .
See this Application Note :
Hope it helps you .
Cheers,
ST1