2017-08-22 03:22 PM
I'm using NUCLEO-L053R8 for USART communication.
below is the configuration of usart2, which connects to the st-link as a COM to PC.
static void MX_USART2_UART_Init(void)
{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.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; if (HAL_UART_Init(&huart2) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); }}
using HAL_UART_Transmit(huart, (uint8_t *)dataString , 1, 0xFF); to trans the data.
But in the terminal, when using 115200 to receive the data, it is not correct.
to trans hello word : ''h68 e65 l6C l6C o6F 20 w77 o6F r72 d64 !21 ''
when using 115200 to receive the data, it received ''80 9E 66 1E 9E E0 9E FE 9E 00 78 7E FE 9E 18 3E 78 06 78 ''
But if I change the receive Baud Rate to 57600(half of 115200), the RX is correct.
Why?
#cortex-m0 #keil #uart #st #usart #st-link #stm32l0 #cortex-m #st-link2023-08-10 03:31 AM
Hi Lingjun,
I also facing the same issue on Nucleo-L053r8 Board, please give me the solution for this if you already rectified.
Thanks
2023-08-10 05:39 AM
Posting to a 6-Year old zombie thread, that's pretty hopeful..
Check the RCC Oscillator code has HSE in BYPASS mode.