‎2022-10-07 02:48 AM
I'm trying the tutorial on UART (https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Step3_Introduction_to_the_UART) with an STM32MP157F-DK2 board.
I tried defining the USART2 GPIOs with CubeMX as found in the reference document UM2637: DP5 - TX, PD6 - RX (I even tried alternate ports such as PA2, PA3). The generated code compiles well.
I then open a Putty connexion on COM19 (the ST Link port) with the required settings, but nothing is printed when I launch the debug.
What am I doing wrong?
Solved! Go to Solution.
‎2022-10-07 06:08 AM
so you send Hello.. in loop. , ok.
Uart 115k/8n1 ok.
+ not Uart2 !
Correct port pins Uart4 to Tx ST Link Port: (seems pg11 on STM32MP157F-DK2 )
‎2022-10-07 04:45 AM
What are you doing ? send char or string? correct port pins to ST Link port ? speed/mode setting?
‎2022-10-07 05:06 AM
Thanks for your answer.
The code is generated by CodeMX, I just added the following lines, as found in the tutorial:
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
uint8_t Test[] = "Hello World !!!\r\n"; //Data to send
HAL_UART_Transmit(&huart2,Test,sizeof(Test),10);// Sending in normal mode
HAL_Delay(1000);
}
/* USER CODE END 3 */
}
Speed / mode settings : also as shown in the tutorial. Is this what you mean?
Here is what is inside the MX_USART2_UART_Init() function:
huart2.Instance = USART2;
huart2.Init.BaudRate = 115200;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart2.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
Correct port pins to ST Link Port: I honestly don't know what you mean here.
‎2022-10-07 05:18 AM
Here is some more information:
I hope it helps
‎2022-10-07 06:08 AM
so you send Hello.. in loop. , ok.
Uart 115k/8n1 ok.
+ not Uart2 !
Correct port pins Uart4 to Tx ST Link Port: (seems pg11 on STM32MP157F-DK2 )
‎2022-10-07 06:29 AM
Great! Thanks a lot, it works !
‎2022-10-07 06:33 AM
... Maybe you can also help me here... :smiling_face_with_smiling_eyes:
https://community.st.com/s/question/0D53W00001qq9ddSAA/cant-blink-a-led-on-stm32mp157dk2