2025-01-21 02:27 AM - last edited on 2025-01-21 02:29 AM by Andrew Neil
Hi,
with the BLE_p2pServer example for STM32WBA55, i want to change the interface from USART1 to USART2. How can i use the trace information like
with USART2?
Solved! Go to Solution.
2025-01-21 03:41 AM
Hello @ledi7
To send the trace information to USART2 instead of USART1 in the BLE_P2PServer app for the Nucleo-WBA55CG you have to:
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-01-21 02:31 AM
If it's using printf, the process is described here:
2025-01-21 02:46 AM
Hi Andrew,
Thanks for the information, but this is not what I want to do. I am using the BLE_p2pServer example for WBA55 and there is already a lot of log information here that I want to use and which is handled in stm32_adv_trace.c for example. This works for USART1, but I want to output this information to USART2. There must be a definition somewhere where I can define the interface for the output.
2025-01-21 03:03 AM
@ledi7 wrote:there is already a lot of log information here that I want to use and which is handled in stm32_adv_trace.c .
So the question was: does that handling use printf ?
If it does, then the link shows you how that works and, thus, how to change it to a different output device.
If not, then just look at the stm32_adv_trace.c code to see where it does handle its UART, and change that ...
2025-01-21 03:11 AM
No, printf is not used here. I tried to find some hints in stm32_adv_trace.c or log_module.c but unfortunately without success.
2025-01-21 03:35 AM
According to the readme.txt,
@note Debug traces can be enabled/disabled in app_conf.h To get the traces, you have to enable CFG_USB_INTERFACE_ENABLE, with CFG_DEBUG_BLE_TRACE for BLE services traces or with CFG_DEBUG_APP_TRACE for application traces. On the PC side: - open a terminal window with the following settings: baud rate of 115200 Byte size of 8 Parity None Stop bits 1 Data Flow Control None Available Wiki pages: - https://wiki.st.com/stm32mcu/wiki/Connectivity:BLE_overview For more details refer to the Application Note: AN5289 - Building a Wireless application
So there's some things to look into ...
2025-01-21 03:41 AM
Hello @ledi7
To send the trace information to USART2 instead of USART1 in the BLE_P2PServer app for the Nucleo-WBA55CG you have to:
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-01-22 12:54 AM
Hello @STTwo-32 ,
Thanks for the information! It works, but only if BLE is not activated (no advertising, no BLE connection). I use the same settings for USART2 as for USART1 with 19200 Baud. The NVIC priorities are also the same.
When I send a byte from HTerm to USART2, I use the Rx callback function in usart_if.c to trigger the task for a notification event (just like when pressing Button1 on the NUCLEO board).
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(&huart2, &charRx, 1);
/* USER CODE BEGIN UsartIf_RxCpltCallback 2 */
/* USER CODE END UsartIf_RxCpltCallback 2 */
}
If no advertising or no ble connection is active, I get the log information (here i send a byte four times via HTerm) without errors:
But when advertising or a BLE connection is active, I usually get confused characters as log information. Here, i also send a byte four times when a BLE connection is established:
2025-01-22 01:18 AM
This is completely a different question. You are not using the USART2 for getting trace information, you are trying to send data from your external system (serial interface) to USART interface and then you want to share it throw BLE. This Completely different from the original request. So, please close this one (by selecting a solution for the original request) and open a New one with a Full configuration, if possible, about what you have done and what you want to do. Also, please try to use only one ST community account to avoid answering twice.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-01-22 03:42 AM