cancel
Showing results for 
Search instead for 
Did you mean: 

UART doesn't work

_Louis_
Associate

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

11 REPLIES 11

@_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?

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..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..


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?

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!


@_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


@_Louis_ wrote:

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


That's the wrong UART!

Oh thanks, I've seen that in the user manual but I can modify the LPUART1in the .ioc:

_Louis__0-1736391074868.png

Do you know how can I access the parameters? 

I can ste the pin manually but will it be enough?

_Louis__1-1736391123570.png

 

Karl Yamashita
Lead III

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

 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

@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?