cancel
Showing results for 
Search instead for 
Did you mean: 

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

ledi001
Senior

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?

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @ledi001 

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

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.

View solution in original post

1 REPLY 1
STTwo-32
ST Employee

Hello @ledi001 

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

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.