cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with USART transmit and USB stack on STM32F105RC

SKole.17
Associate II

Hello! I trying to use usart1 in main cycle, and VCP USB in usb interrupts. USB works fine, until i not using usart.

When i try continiosely send data in main cycle, usb stack not working(enumeration fails):

while (1)
 {
 
    HAL_UART_Transmit(&huart1, (uint8_t*)"Hello World\n", 12, 10);
 
   /* USER CODE END WHILE */
 
 
   /* USER CODE BEGIN 3 */
 
 }

When i change USART1 to USART3, usb works normally... I can't understand - whats happens?

STM32CubeMX version : 5.2.1

Mcu: STM32F105RC

Optimizaion O0 and O1, behavior is the same.

1 ACCEPTED SOLUTION

Accepted Solutions
SKole.17
Associate II

For the OTG_FS_VBUS pin (PA9) to be used by another shared peripheral or as a general-purpose IO, the

PHY Power-down mode has to be active (clear bit 16 in the OTG_FS_GCCFG register)

On page 169 of RM0008.

Thanks for you help..

But in STM32Cube this pin not locked when usb enabled.. It is a very unpleasant surprise. If you fix this, you may safe a lot of time of developers.

View solution in original post

6 REPLIES 6
Ons KOOLI
Senior III

Hi Skole.17,

Please refer to the STM32CubeF1, you can find ready developed CDC_Standalone USB device applications.

Else, if you are using CubeMX, can you please share your .ioc file.

Best Regards,

Ons.

SKole.17
Associate II

I am using Cube IDE. That is my ioc file

Ons KOOLI
Senior III

Hi Skole.17,

Are you using an ST board or your custom board ?

If you are using an ST board, which is ?

Best Regards,

Ons.

SKole.17
Associate II

I am using custom board.

Problem not in usart1. Usart1 TX pin and usb vbus has same gpio. In progect settings VBUS not selected... but usb not working, if VBUS pin(PA9) in LOW state.

SKole.17
Associate II

For the OTG_FS_VBUS pin (PA9) to be used by another shared peripheral or as a general-purpose IO, the

PHY Power-down mode has to be active (clear bit 16 in the OTG_FS_GCCFG register)

On page 169 of RM0008.

Thanks for you help..

But in STM32Cube this pin not locked when usb enabled.. It is a very unpleasant surprise. If you fix this, you may safe a lot of time of developers.

Ons KOOLI
Senior III

Hi Skole.17,

Thank you for your feedback.

We will take this into consideration.

Please select the best answer, even if it is yours 😊 . This helps other people who have same problem as yours. 

Best Regards,

Ons.