2024-11-20 03:17 AM
Goodmorning
I have a new STM32L496ZGT6PU board and I'm currently trying to print a message on the debugger serial terminal, I've followed many official guides step by step failing every time.
In particular, I perform the following:
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_UART_Transmit(&huart2, (uint8_t*)"Ciao ", 6, 100);
HAL_Delay(1000);
}
/* USER CODE END 3 */
Then I build the project and start Debug keeping the default settings.
During the debug I create a new command shell console with
By clicking on "resume", the code seems to run, but nothing pops on the serial console.
I tried to use an equal board, change the cable, and change USART interface but this didn't solve the problem.
Solved! Go to Solution.
2024-11-20 03:32 AM
@RiccardoMilici wrote:3. In Pinout & Configuration I go to Connectivity -> USART2 -> Mode Asynchronous and leave the default values.
User manual says it's LPUART1 connected to the VCP:
2024-11-20 03:28 AM - edited 2024-11-20 04:04 AM
Hello @RiccardoMilici ,
Check your pins configuration and I recommend you follow these articles :
2024-11-20 03:32 AM
@RiccardoMilici wrote:3. In Pinout & Configuration I go to Connectivity -> USART2 -> Mode Asynchronous and leave the default values.
User manual says it's LPUART1 connected to the VCP:
2024-11-20 03:53 AM - edited 2024-11-20 03:54 AM
Hello,
Simply because USART2 is not connected to STLINK virtual comport on NUCLEO-L496ZG-P board.
Based on the board schematics, you need to use LPUART1 instead:
2024-11-20 04:06 AM
@Imen.D wrote:Check your pins configuration and the USART2 alternate functions on which pins are mapped.
It's LPUART1 - not USART2
@Imen.D wrote:I recommend you follow these articles :
- How to redirect the printf function to a UART for ... - STMicroelectronics Community
- Getting started with UART - stm32mcu
Yes, but they should be done in the opposite order:
2024-11-20 04:16 AM - edited 2024-11-20 10:46 PM
You are right, I didn't pay attention on the used board.
Thank you @Andrew Neil for pointing out to me.