2024-10-31 09:29 PM
I used NUCLEO-F103RB (MB1136 Rev C) and X-NUCLEO-NFC03A1 to run the example program in X-CUBE-NFC3. I received data from the serial port using 115200-8N1 and received the following:
okcykkykkhht nkgkkkkfkca{sytcki{s{on qskkqcnsg
Then I used a logic analyzer to detect the speed of the serial port, and after calculation, the actual baud rate was 90909. I received the correct content using the calculated baud rate:
Welcome to X-NUCLEO-NFC03A1
Use the User button to cycle among the different modes:
1. Tap a tag to read its content
2. Present a tag to write a Text record
3. Present a tag to write a URI record and an Android Application record
4. Present an ST tag
to format
In Write or Format mode (menu 2, 3 or 4), the demo returns to Read mode (menu 1) if no tag detected after 10 seconds
1. Tap a tag to read its content
However, the serial port configuration in the example code is 115200:
static void MX_USART2_UART_Init(void)
{
/* USER CODE BEGIN USART2_Init 0 */
/* USER CODE END USART2_Init 0 */
/* USER CODE BEGIN USART2_Init 1 */
/* USER CODE END USART2_Init 1 */
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;
if (HAL_UART_Init(&huart2) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
/* USER CODE BEGIN USART2_Init 2 */
/* USER CODE END USART2_Init 2 */
}
I have checked the clock output (MCO) and all jumper resistors from the onboard ST Link and everything is normal. I have also modified the clock configuration, but this issue has persisted. Can someone tell me how to solve the problem of baud rate error.
2024-10-31 10:17 PM
Hi,
For the information you have given, it suggests your usart clock is not right...
Kind regards
Pedro
2024-11-03 10:00 PM
MCO is only from STLINK MCU side. you need to check F103RB itself by PA8 on pin CN9.8,
2024-11-03 11:34 PM
Yes, I detected the actual baud rate of STM32F103RB through PA8 and PA9, and it is 90909bps.
2024-11-04 12:07 AM
So the clock configuration is wrong. Why don't you fix it?
2024-11-04 12:19 AM
I don't know how to modify it, I'm not familiar with STM32, I just want to run the official X-CUBE-NFC3 sample program.