Skip to main content
Associate III
January 22, 2025
Question

How to use USART2 instead of USART1 in BLE_p2pServer example?

  • January 22, 2025
  • 2 replies
  • 617 views

Hi @STTwo-32 ,

I am using the BLE_p2pServer example with NUCLEO-WBA55 and want to use USART2 instead of USART1. If I use USART1 and send a byte via HTerm, the task UTIL_SEQ_SetTask( 1<<CFG_TASK_SEND_NOTIF_ID, CFG_SEQ_PRIO_0); should be executed as soon as an RxCpltCallback event (in file usart_if.c) is triggered.

static void UsartIf_RxCpltCallback(UART_HandleTypeDef *huart)
{
 /* USER CODE BEGIN UsartIf_RxCpltCallback 1 */
	UTIL_SEQ_SetTask( 1<<CFG_TASK_SEND_NOTIF_ID, CFG_SEQ_PRIO_0);
 /* USER CODE END UsartIf_RxCpltCallback 1 */

 RxCpltCallback(&charRx, 1, 0);
 HAL_UART_Receive_IT(&huart1, &charRx, 1);

 /* USER CODE BEGIN UsartIf_RxCpltCallback 2 */

 /* USER CODE END UsartIf_RxCpltCallback 2 */
}

When I establish a BLE connection with the “nRF Connect” app, I receive the corresponding notification (Same effect as when I press button1)

2025-01-22_11h21_15.png

and I also receive the corresponding logs via HTerm.

2025-01-22_11h23_49.png

But if I now change “serial links for logs” to USART2 and configure USART2 exactly the same as USART1, I get confused characters as log information like this:

2025-01-22_09h49_41.png

2 replies

Andrew Neil
Super User
January 22, 2025
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Technical Moderator
March 5, 2025

Hi,
Can you try activating Hardware Flow Control (RS232) CTS + RTS?
This can be done via MX in the UART config.
Let me know if you still have this behavior, please.
BR, Joé