2024-10-03 4:36 AM - last edited on 2024-10-03 5:00 AM by mƎALLEm
good morning. since this morning, on my nucleoH755ZIQ I am trying to make work my UART connection. I followed the stm video on YouTube and did as said:
connected USART 2 (doesn't USART 1 work?)
and then implemented the simple code
in the while loop of my main. unfortunately, when I run the console, nothing appears. I even tried it on putty and again nothing came out. so I decided to change board and take the NUCLEO C031C6 but this time could not even access the USART 2.
does somebody knows what could be the problem or have a simple code I could try to understand if the problem is the hardware or the software?
best regards
Solved! Go to Solution.
2024-10-03 4:57 AM - edited 2024-10-03 4:59 AM
Hello,
If you are using Virtual Comport of STLINK, this is normal as USART1 is not connected to the VCP but USART3.
So use USART3 instead with the correct Tx/Rx pins.
Please review the board schematics before suspecting an issue in the software.
Hope it helps
2024-10-03 4:57 AM - edited 2024-10-03 4:59 AM
Hello,
If you are using Virtual Comport of STLINK, this is normal as USART1 is not connected to the VCP but USART3.
So use USART3 instead with the correct Tx/Rx pins.
Please review the board schematics before suspecting an issue in the software.
Hope it helps
2024-10-03 6:59 AM
thank you for the response, I was searching virtual com port and not vcc so I did no see it. however I got another problem on stm32: USART mode 3 is impossible to put the mode into available:
I wanted to do it manually by turning directly the pins of PD9 and PD10 into tx nd rx but it doesn't want to turn on the usart3. I think I am missing something.
2024-10-03 7:02 AM
Hello @Jad,
I suggest to open a new thread regarding the last question.
Thank you.
2025-10-22 11:57 AM
This reply is late but I hope it will be useful for future reference for other users, since the original one didn't help me, but I managed to get it to work.
Even when you can't turn on USART3 via Cube MX, you can still turn it on via software in your main.c. Just manually add the config for USART3, for example:
static void MX_USART3_UART_Init(void)
{
huart3.Instance = USART3;
huart3.Init.BaudRate = 115200;
huart3.Init.WordLength = UART_WORDLENGTH_8B;
huart3.Init.StopBits = UART_STOPBITS_1;
huart3.Init.Parity = UART_PARITY_NONE;
huart3.Init.Mode = UART_MODE_TX_RX;
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart3) != HAL_OK) {
Error_Handler();
}
if (HAL_UARTEx_SetTxFifoThreshold(&huart3, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK) {
Error_Handler();
}
if (HAL_UARTEx_SetRxFifoThreshold(&huart3, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK) {
Error_Handler();
}
if (HAL_UARTEx_DisableFifoMode(&huart3) != HAL_OK) {
Error_Handler();
}
}
and then use huart3 as usual for printing to serial port. It works well.