Skip to main content
ledi001
Associate III
November 1, 2024
Solved

STM32WBA55 example BLE_p2pServer_ota - where to place application code to handle the payload?

  • November 1, 2024
  • 1 reply
  • 839 views

Hello,

It seems that the example BLE_p2pServer_ota works with an operating system? I want to forward certain payload data to a UART2 interface via DMA after a connection has been established.

Where is the right place to insert a HAL_UART_Tx_DMA transmission function in the code?

In the example provided, the function to check the payload is queried in the p2p_server_app.c file in line 122:

 

if(p_Notification->DataTransfered.p_Payload[1] == 0x01)
 {
 BSP_LED_On(LED_BLUE);
 LOG_INFO_APP("-- P2P APPLICATION SERVER : LED1 ON\n"); 
 P2P_SERVER_APP_Context.LedControl.Led1 = 0x01; /* LED1 ON */
 // Here, i want to include the HAL_USART_Tx function ...
 }
 if(p_Notification->DataTransfered.p_Payload[1] == 0x00)
 {
 BSP_LED_Off(LED_BLUE);
 LOG_INFO_APP("-- P2P APPLICATION SERVER : LED1 OFF\n"); 
 P2P_SERVER_APP_Context.LedControl.Led1 = 0x00; /* LED1 OFF */
 }

 

For example, here i want to transfer the string "LED ON" to USART2.

Is this the right place to insert the code?

Best answer by STTwo-32

Hello @ledi001 

Yes, you can add the function of send data throw USART2 on the line you mentioned.

Best Regards.

STTwo-32

1 reply

STTwo-32
STTwo-32Best answer
Technical Moderator
November 20, 2024

Hello @ledi001 

Yes, you can add the function of send data throw USART2 on the line you mentioned.

Best Regards.

STTwo-32