cancel
Showing results for 
Search instead for 
Did you mean: 

Turning BLE on and off in STM32WB55

IlliaGx
Associate II

Hello.
I have problems turning BLE on and off on STM32WB55.

Many examples with BLE start with the lines

MX_APPE_Config();
MX_IPCC_Init();
MX_RF_Init();
MX_APPE_Init();

I do the same, and it turns on right away. I don't know how to initialize the sequencer and timeservers by themselves without BLE, so for now, I found a workaround. I turn it off using the RTC timer using the code the esteemed @FilipKremen provided me

static void BLE_exit()
{
	tBleStatus ret;
	if (BleApplicationContext.Device_Connection_Status != APP_BLE_IDLE)
	{
		ret = aci_gap_terminate(BleApplicationContext.BleApplicationContext_legacy.connectionHandle, 0x13);
		if (ret != BLE_STATUS_SUCCESS)
		    {
		      APP_DBG_MSG("aci_gap_terminate(), Failed \r\n\r");
		    }
		    else
		    {
		      APP_DBG_MSG("aci_gap_terminate(), Successfully \r\n\r");
		    }
	}

	ret = aci_hal_stack_reset();
	if (ret != BLE_STATUS_SUCCESS)
			 {
			    APP_DBG_MSG("aci_hal_stack_reset(), Failed \r\n\r");
			 }
			 else
			 {
			    APP_DBG_MSG("aci_hal_stack_reset(), Successfully \r\n\r");
			 }
}

Then I have buttons on the sequencer tasks, and the time server is still working, and I don't really understand how to enable Bluetooth with a button. Should I somehow reinitialize everything? But how can I not affect the logic of the sequencer and time server? I try to use this function 

appe_Tl_Init(); /* Initialize all transport layers */

from MX_APPE_Init in the button handler, but nothing happens, and sometimes it even hits the error handler.

Also, maybe there is a more correct way to initialize the sequencer and timeserver without initializing the BLE? How should it be turned on correctly, then?

Also, I wonder how good the idea of ​​using a sequencer and timeserver is for processing the logic of buttons and LEDs? I think that's what it was intended for?

I would be extremely grateful for your help.

 

0 REPLIES 0