cancel
Showing results for 
Search instead for 
Did you mean: 

stm23wb5mmg ble notify problem

Lep
Senior
I used stm32wb55rgv6 and stm32wb5mmg in the stm32wb series for simple Bluetooth projects (using hw_timeserver to send notification data), and then used nRF Connect to receive notification data.
My program and design are basically the same, but only stm32wb55rgv6 succeeded, while stm32wb5mmg failed, as shown in the figure:

 

 

Lep_1-1695366465540.png

Lep_2-1695366538738.png

I have compared these two projects many times, and based on an5289, I think his process is quite normal. I guess there is something wrong with the design of HW_timeserver timing triggering. For the specific design, see the program in p2p_server_app.c below:

 

/* USER CODE BEGIN Header */

/**

******************************************************************************

* @file App/p2p_server_app.c

* @author MCD Application Team

* @brief Peer to peer Server Application

******************************************************************************

* @attention

*

* Copyright (c) 2023 STMicroelectronics.

* All rights reserved.

*

* This software is licensed under terms that can be found in the LICENSE file

* in the root directory of this software component.

* If no LICENSE file comes with this software, it is provided AS-IS.

*

******************************************************************************

*/

/* USER CODE END Header */

 

/* Includes ------------------------------------------------------------------*/

#include "main.h"

#include "app_common.h"

#include "dbg_trace.h"

#include "ble.h"

#include "p2p_server_app.h"

#include "stm32_seq.h"

 

/* Private includes ----------------------------------------------------------*/

/* USER CODE BEGIN Includes */

 

/* USER CODE END Includes */

 

/* Private typedef -----------------------------------------------------------*/

/* USER CODE BEGIN PTD */

 

/* USER CODE END PTD */

 

/* Private defines ------------------------------------------------------------*/

/* USER CODE BEGIN PD */

typedef struct

{

 

uint8_t TimerMeasurement_Id;

 

} HRSAPP_Context_t;

 

static HRSAPP_Context_t HRSAPP_Context;

/* USER CODE END PD */

 

/* Private macros -------------------------------------------------------------*/

/* USER CODE BEGIN PM */

 

/* USER CODE END PM */

 

/* Private variables ---------------------------------------------------------*/

/* USER CODE BEGIN PV */

 

/* USER CODE END PV */

 

/* Private function prototypes -----------------------------------------------*/

/* USER CODE BEGIN PFP */

static void HrMeas( void );

static void HRSAPP_Measurement(void);

/* USER CODE END PFP */

 

/* Functions Definition ------------------------------------------------------*/

void P2PS_STM_App_Notification(P2PS_STM_App_Notification_evt_t *pNotification)

{

/* USER CODE BEGIN P2PS_STM_App_Notification_1 */

 

/* USER CODE END P2PS_STM_App_Notification_1 */

switch(pNotification->P2P_Evt_Opcode)

{

/* USER CODE BEGIN P2PS_STM_App_Notification_P2P_Evt_Opcode */

 

/* USER CODE END P2PS_STM_App_Notification_P2P_Evt_Opcode */

 

case P2PS_STM__NOTIFY_ENABLED_EVT:

/* USER CODE BEGIN P2PS_STM__NOTIFY_ENABLED_EVT */

HW_TS_Stop(HRSAPP_Context.TimerMeasurement_Id);

HW_TS_Start(HRSAPP_Context.TimerMeasurement_Id, 20);

/* USER CODE END P2PS_STM__NOTIFY_ENABLED_EVT */

break;

 

case P2PS_STM_NOTIFY_DISABLED_EVT:

/* USER CODE BEGIN P2PS_STM_NOTIFY_DISABLED_EVT */

HW_TS_Stop(HRSAPP_Context.TimerMeasurement_Id);

/* USER CODE END P2PS_STM_NOTIFY_DISABLED_EVT */

break;

 

case P2PS_STM_WRITE_EVT:

/* USER CODE BEGIN P2PS_STM_WRITE_EVT */

 

/* USER CODE END P2PS_STM_WRITE_EVT */

break;

 

default:

/* USER CODE BEGIN P2PS_STM_App_Notification_default */

 

/* USER CODE END P2PS_STM_App_Notification_default */

break;

}

/* USER CODE BEGIN P2PS_STM_App_Notification_2 */

 

/* USER CODE END P2PS_STM_App_Notification_2 */

return;

}

 

void P2PS_APP_Notification(P2PS_APP_ConnHandle_Not_evt_t *pNotification)

{

/* USER CODE BEGIN P2PS_APP_Notification_1 */

 

/* USER CODE END P2PS_APP_Notification_1 */

switch(pNotification->P2P_Evt_Opcode)

{

/* USER CODE BEGIN P2PS_APP_Notification_P2P_Evt_Opcode */

 

/* USER CODE END P2PS_APP_Notification_P2P_Evt_Opcode */

case PEER_CONN_HANDLE_EVT :

/* USER CODE BEGIN PEER_CONN_HANDLE_EVT */

 

/* USER CODE END PEER_CONN_HANDLE_EVT */

break;

 

case PEER_DISCON_HANDLE_EVT :

/* USER CODE BEGIN PEER_DISCON_HANDLE_EVT */

 

/* USER CODE END PEER_DISCON_HANDLE_EVT */

break;

 

default:

/* USER CODE BEGIN P2PS_APP_Notification_default */

 

/* USER CODE END P2PS_APP_Notification_default */

break;

}

/* USER CODE BEGIN P2PS_APP_Notification_2 */

 

/* USER CODE END P2PS_APP_Notification_2 */

return;

}

 

void P2PS_APP_Init(void)

{

/* USER CODE BEGIN P2PS_APP_Init */

UTIL_SEQ_RegTask( 1<< CFG_TASK_MEAMMM_ID, UTIL_SEQ_RFU, HRSAPP_Measurement );

HW_TS_Create(CFG_TIM_PROC_ID_ISR, &(HRSAPP_Context.TimerMeasurement_Id), hw_ts_Repeated, HrMeas);

/* USER CODE END P2PS_APP_Init */

return;

}

 

/* USER CODE BEGIN FD */

 

/* USER CODE END FD */

 

/*************************************************************

*

* LOCAL FUNCTIONS

*

*************************************************************/

/* USER CODE BEGIN FD_LOCAL_FUNCTIONS*/

static void HRSAPP_Measurement(void)

{

/* Update P2P_NOTIFY characteristic */

uint8_t value[120]={0};

 

P2PS_STM_App_Update_Char(P2P_NOTIFY_CHAR_UUID, &value[0]);

 

return;

}

 

static void HrMeas( void )

{

 

UTIL_SEQ_SetTask( 1<<CFG_TASK_MEAMMM_ID, CFG_SCH_PRIO_0);

return;

}

/* USER CODE END FD_LOCAL_FUNCTIONS*/

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

This problem has been solved. The reason for this problem is that some interrupts are not enabled.

View solution in original post

3 REPLIES 3
Issamos
Lead II

Hello @Lep 

I suggest you to debug your code step by step to understand the issue with the code for the STM32WB5MMG.

Best regards.

II

Thank you for your reply. I still haven't solved this problem. You can understand my problem as: implementing a simple Bluetooth notification function (BLE-p2pserver) based on stm32wb5mmg. I can connect normally and find the notify characteristic, but I can't update the notify value.

Lep_0-1696041201850.png

 

 

This problem has been solved. The reason for this problem is that some interrupts are not enabled.