Skip to main content
Visitor II
December 17, 2020
Solved

Problem with USART transmit and USB stack on STM32F105RC

  • December 17, 2020
  • 6 replies
  • 1436 views

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.

    This topic has been closed for replies.
    Best answer by SKole.17

    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.

    6 replies

    Visitor II
    December 17, 2020

    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.17Author
    Visitor II
    December 17, 2020

    I am using Cube IDE. That is my ioc file

    Visitor II
    December 17, 2020

    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.17Author
    Visitor II
    December 18, 2020

    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.17AuthorAnswer
    Visitor II
    December 18, 2020

    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.

    Visitor II
    December 18, 2020

    Hi Skole.17,

    Thank you for your feedback.

    We will take this into consideration.

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

    Best Regards,

    Ons.