Skip to main content
LCho.1
Associate II
July 12, 2022
Solved

USART2 works but other USARTS don't work. (STM32F446RE)

  • July 12, 2022
  • 2 replies
  • 1853 views

Hello,

I am struggling to use multiple USARTs. I tested that USART2 works fine but I cannot get USART1 and USART3 to work.

If I can't use multiple USARTs at the same time, I would like to use only USART3. However, USART3 does not work. Do I need to change settings on the Windows to use different USART?

I am using STM32F446 nucleo board and using Putty to see serial port on windows.

Any help would be very appreciated!

Thank you

void SendInitString(void)
{
	uint8_t Test3[] = "Hello World 33 !!!\r\n"; //Data to send
	HAL_UART_Transmit(&huart3,Test3,sizeof(Test3),10);// Sending in normal mode
 
	uint8_t Test2[] = "Hello World 22 !!!\r\n"; //Data to send
	HAL_UART_Transmit(&huart2,Test2,sizeof(Test2),10);// Sending in normal mode
 
	uint8_t Test1[] = "Hello World 11 !!!\r\n"; //Data to send
	HAL_UART_Transmit(&huart1,Test1,sizeof(Test1),10);// Sending in normal mode
	HAL_Delay(1000);
}
 
int main(void)
{
 /* USER CODE BEGIN 1 */
 
 /* USER CODE END 1 */
 
 /* MCU Configuration--------------------------------------------------------*/
 
 /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
 HAL_Init();
 
 /* USER CODE BEGIN Init */
 
 /* USER CODE END Init */
 
 /* Configure the system clock */
 SystemClock_Config();
 
 /* USER CODE BEGIN SysInit */
 
 /* USER CODE END SysInit */
 
 /* Initialize all configured peripherals */
 MX_GPIO_Init();
 MX_USART3_UART_Init();
 MX_USART2_UART_Init();
 MX_USART1_UART_Init();
 /* USER CODE BEGIN 2 */
 
 /* USER CODE END 2 */
 
 /* Infinite loop */
 /* USER CODE BEGIN WHILE */
 while (1)
 {
	 SendInitString();
 /* USER CODE END WHILE */
 
 /* USER CODE BEGIN 3 */
 
 }
 /* USER CODE END 3 */
}

This topic has been closed for replies.
Best answer by Andrew Neil

@LCho.1​ "The solution was to connect tx and rx of usart3 to FTDI cable"

Not sure what you mean by that - please explain further?

Obviously, the ST-Link's VCP on the Nucleo board is hardwired to 2 pins on the STM32 - this is explained in the documentation, and you can see it in the schematics.

The VCP can only connect to one UART at a time.

So, if you want to use a different UART, you'd have to

  1. disconnect the original links
  2. add new links as required.

0693W000008y9fZQAQ.png

2 replies

LCho.1
LCho.1Author
Associate II
July 12, 2022

The solution was to connect tx and rx of usart3 to FTDI cable, not rely only on the usb cable connected to the nucleo board

Andrew Neil
Andrew NeilBest answer
Super User
July 13, 2022

@LCho.1​ "The solution was to connect tx and rx of usart3 to FTDI cable"

Not sure what you mean by that - please explain further?

Obviously, the ST-Link's VCP on the Nucleo board is hardwired to 2 pins on the STM32 - this is explained in the documentation, and you can see it in the schematics.

The VCP can only connect to one UART at a time.

So, if you want to use a different UART, you'd have to

  1. disconnect the original links
  2. add new links as required.

0693W000008y9fZQAQ.png

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.