2024-11-12 02:22 AM - last edited on 2024-11-12 02:37 AM by SofLit
Original post: https://community.st.com/t5/stm32cubemx-mcus/problems-with-data-reception-via-usart2-on-stm32f429zi/td-p/741765
Even setting USART3 it doesn't work (see attachments). Did I make a mistake setting some parameters, or is something missing? Thanks a lot
2024-11-12 02:24 AM
The attachments are not helpful. Normally you need to share your code and attach your ioc file.
Meanwhile, you can use this example already running on STM32F429ZI-Nucleo board:
Hope it helps.
2024-11-12 02:30 AM
See the Posting Tips for how to properly post source code:
2024-11-12 02:34 AM - edited 2024-11-12 02:39 AM
I noticed you are using F429 disco board that it is using USART1.
See the example I attached in this thread.
As stated by @Andrew Neil you need to share the code + provide which HW you are using, ST board? Custom board? this prevents us to provide you wrong answers.
2024-11-12 02:47 AM - edited 2024-11-12 02:50 AM
Hello @Emanuele78 , did you mistakenly accept the wrong comment as solution ?
2024-11-12 02:50 AM
Given that I am using the STM32F429ZIT6 DISCOVERY KIT connected to the PC via USB, from the received messages I didn’t understand whether I should use USART3 or USART1. I tried following the instructions, but it doesn’t work.
Ok, the code in main.c is very simple:
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
if(HAL_GPIO_ReadPin(Pulsante_on_board_GPIO_Port, Pulsante_on_board_Pin))
{
stato = !stato;
HAL_Delay(250);
}
HAL_GPIO_WritePin(Led_on_board_LD3_GPIO_Port, Led_on_board_LD3_Pin, stato);
if(HAL_UART_Transmit(&huart3, (const uint8_t *)"TEST ", 6, 100) !=HAL_OK)
Error_Handler();
HAL_Delay(500);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
2024-11-12 02:54 AM
Yes, sorry..
2024-11-12 02:56 AM
2024-11-12 02:56 AM - edited 2024-11-12 03:26 AM
Please refer to the thread I provided to you (there is an example of printf attached): https://community.st.com/t5/stm32-mcus-embedded-software/how-to-use-printf/m-p/736985#M56462
F429-DISCO is using USART1 connected to VCP:
From the user manual of the board:
From F429-DISCO schematics:
Hope it helps.
2024-11-12 03:18 AM
@Emanuele78 wrote:I am using the STM32F429ZIT6 DISCOVERY KIT connected to the PC via USB ... I didn’t understand whether I should use USART3 or USART1
You need to use whichever USART is connected through to that USB connection!
That will be stated in the User Manual for the board, and can also be seen in the schematics of the board.