Showing results for 
Search instead for 
Did you mean: 

USART communication between STM32L152RE and Arduino UNO

Associate II

I am able to transmit data from STM32WL to Arduino UNO board using USART Serial communication but on following the same procedure I am not able to transmit the data from STM32L152RE to Arduino board though baud rate matches and the code and circuit connections are fine.

This is how I configured the port.



And this is my part of the code for USART Communication.

uint8_t tx_buffer[64] = "Hello world \r\n";

while (1)



HAL_UART_Transmit(&huart1, tx_buffer, 8, HAL_MAX_DELAY);





Can anyone recommend what could possibly go wrong in setting up the USART communication using the STM32L152RE board.

Michael E
ST Employee

Hello @Subha_shree_bask,

Could you provide the USART setting of the Arduino?

Do the settings match those of the NUCLEO?


This Wiki article might also be helpful

Best Regards


To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Yes, the USART settings of the NUCLEO matches


And the following is my Arduino code (I used the same code which worked for STM32WL)



Hello @Subha_shree_bask ,

We don't know about other Arduino UART settings: parity, word length etc..

As you already succeeded to communicate with STM32WL, are you sure you had set the same UART parameters for STM32L152 device as for STM32WL? i.e. parity, word length etc ?

Also you need to double check your hardware. Are you sure you have connected UART pins to the right IOs with a common GND?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Yes mam I am using the same Arduino code as I used for the STM32WL board, Also the parity and word length I did not the fix anything its a default parameter in the Arduino IDE. Only there is an option to select the baud rate in the IDE.

Senior III

Are you sure that the code in STM is OK? I see there, for example, that HAL_UART_Transmit is call after /* USER CODE END WHILE */ Attach your main.c code as a file so it can be checked. Or try to debug it to make sure that the commands for Tx are called at all. Also note that the Arduino UNO uses 5V logic while the STM32 uses 3.3V logic. And it would also be good to check with an oscilloscope or a logic analyzer if any signal is generated on the STM32 pins (whether the assignment is correct).

Forward out a different Serial port.

Serial is presumably the USB Serial of the Arduino. 

Define the port and pins used by the Arduino for the connectivity you're complaining about.

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

Implement error handling in your code. Check for errors in the USART communication using the HAL_UART_Transmit() return value.

Yes the STM Code is fine because I tried the same lines for STM32WL55 board, and instead of Arduino UNO I tried with ESP8266 NodeMCU it works fine. 


And I used the same code for STM32L152RE code and connected the STM board with ESP8266, which uses 3.3V logic. When the RX and TX lines are connected with the ESP8266 there is no Serial output it is just stuck


but when I remove the RX and TX wires the output is printed that it received when it was connected.


Again when I am connecting the wires the serial monitor is stuck. I tried using a different Serial Monitor the result is the same. So I guess from STM32L152 board the string is getting transmitted.


I have attached the main.c file that I uploaded for the STM32L152RE board.