cancel
Showing results for 
Search instead for 
Did you mean: 

stm32wb configure ble as observer in middleware without overridden by cubemx

vd
Associate III

I have generated ble middleware using cubemx with application type set to the server profile. I'd like the device to be able to advertise and scan for non-connectable ad's. Hence in the ble_conf.h I have set BLE_CFG_PERIPHERAL as well as BLE_CFG_CENTRAL to 1. However, in the Ble_Tl_Init( ), app_ble.c, I have overridden the ble central to use the observer role as shown below.

#if (BLE_CFG_PERIPHERAL == 1)
  role |= GAP_PERIPHERAL_ROLE;
#endif
 
#if (BLE_CFG_CENTRAL == 1)
  role |= GAP_OBSERVER_ROLE;//GAP_CENTRAL_ROLE;
#endif

I did the above so I can configure the device to advertise as well as scan for non-connectable advertisements using the aci_gap_start_observation_proc( ) API.

How do I prevent cubemx from overriding this change or is there a way I can achieve the same without having to manually make this change every time cubemx generates code?

PS: I did try configuring calling aci_gap_init( ) separately, to override the role settings but for some reason, it ends up in a fault handler, I don't remember exactly which one though. Before I go about trying to figure out why this happens, I'd like to check if there's an easier way out of this.

2 REPLIES 2
vd
Associate III

Isn't there anyone here that's come across this issue or advice on this?

Remy ISSALYS
ST Employee

Hello,

Indeed, there isn't any possibility to prevent cubeMX from overriding the modification. A user section will be added in order to manage the GAP role in the next version.

Best Regards