Skip to main content
Graduate
January 8, 2025
Solved

UART doesn't work

  • January 8, 2025
  • 4 replies
  • 2815 views

Hi evryone,

 

I'm trying to initialise a very basic UART communication between my stm32 L552ZE-Q and my computer by following this tutorial: https://www.youtube.com/watch?v=dEQwSl8mCFs&t=924s

 

I have no errors, no warning while compiling and the problem is that there is nothing displayed on the PuTTy teminal. I also used TeraTerm and VScode serial terminal and nothing happened. I tried also on an other computer and same problem.

_Louis__2-1736331047092.png

 

I have upgraded the code by adding a blinking LED to verify if something is even running and the LED is blinking but again nothing on Putty...

 

 while (1)
 {

 /* USER CODE END WHILE */

 /* USER CODE BEGIN 3 */
	 HAL_UART_Transmit(&huart2, tx_buffer, 27, 10);
	 HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_9);
	 HAL_Delay(1000);
 }

 

I've checked the COM port used in my device manager and set the correct Baud rate, I don't know to do next.

_Louis__0-1736330985875.png_Louis__1-1736331018777.png

 

Thank you for your help!

 

Louis

    This topic has been closed for replies.
    Best answer by _Louis_

    Hello,

    I found how to enable LPUART1 I just unchecked all the default initialization from cube IDE when creating a project and I can now communicate with my computer with no problems!

    Hope that will help somebody!

    4 replies

    Super User
    January 8, 2025

    @_Louis_ wrote:

    _Louis__0-1736330985875.png


    So you're using the Virtual COM Port (VCP) in an ST-Link.

    What board are you using?

    Are you sure that you are using the correct UART - the one that's actually connected to the VCP?

    _Louis_Author
    Graduate
    January 9, 2025


    Hi Andrew,

     

    I'm using the NUCLE-L552ZE-Q board.

     


    Are you sure that you are using the correct UART - the one that's actually connected to the VCP?


    I don't really know, I'm trying to follow the tutorial and adapt it to my board  so I have that on the .ioc file:

    _Louis__0-1736386550896.png

    The VCP_RX/TX are in reset state so you say that I should try to enable them?

    Super User
    January 9, 2025

    @_Louis_ wrote:


    I'm using the NUCLE-L552ZE-Q board.


    So look at its User Manual to see which UART is connected to the ST-Link's VCP:

    AndrewNeil_0-1736388007884.png

    https://www.st.com/resource/en/user_manual/um2581-stm32l5-nucleo144-board-mb1361-stmicroelectronics.pdf#page=26

     

    As you can see, it's LPUART1 (on PG7, PG8) which is connected to the ST-LINK's VCP

    Graduate II
    January 8, 2025

    Not clear how you're initailizing the UART and Pins on the NUCLEO-L552ZE-Q

    Doesn't it use LPUART1 on PG7 / PG8? And not USART2

    So you'd also have to enable the VDDIO2 for GPIOG

    Show code..

    _Louis_Author
    Graduate
    January 9, 2025

    Hi,

    I initialized the UART and pins via the .ioc file, Connectivity -> USART2 -> Mode: Asynchronous and  NVIC Settings to activate the USART2 global interrupt as done in the tutorial I follow.

    _Louis__0-1736386789308.png

     


    @Tesla DeLorean wrote:

    Doesn't it use LPUART1 on PG7 / PG8? And not USART2


    PA2 an PA3 are configured respectively in USART_TX an USART_RX states and PG7/8 are in reset state.

     


    @Tesla DeLorean wrote:

    So you'd also have to enable the VDDIO2 for GPIOG


    What is it for and how can I do that?

     


    @Tesla DeLorean wrote:

    Show code..


    Do you want any specific part or file or I just dump it there for you?

     

    Thank for your time and help!

    Super User
    January 9, 2025

    @_Louis_ wrote:

    I initialized the UART and pins via the .ioc file, Connectivity -> USART2 


    That's the wrong UART!

    Graduate II
    January 9, 2025

    There seems to be an issue with STM32CubeIDE when trying to enable LPUART1.

    As you can see, PG7 and PG8 are in reset state. When selecting LPUART1, the configurations are grayed out so you can't change the Mode.

     

    KarlYamashita_0-1736391286118.png

     

    _Louis_Author
    Graduate
    January 9, 2025

    @Karl Yamashita wrote:

    When selecting LPUART1, the configurations are grayed out so you can't change the Mode.


    So there is no way that I can change the mode?

     

    Graduate II
    January 9, 2025

    You'd have to wait for ST to fix it or you'll have to manually write the configurations. Or try another Nucleo board that doesn't have the same issue.

    _Louis_AuthorAnswer
    Graduate
    January 21, 2025

    Hello,

    I found how to enable LPUART1 I just unchecked all the default initialization from cube IDE when creating a project and I can now communicate with my computer with no problems!

    Hope that will help somebody!