Silicon labs - Ble loss connection

Thread Starter

BigShawarma

Joined Jan 20, 2025
7
Hi everyone,

I'm working with a Silicon Labs BGM121 microcontroller using Simplicity Studio, and developing in C.

  • Server: My BGM121-based device (referred to as "marker") that streams raw sensor data over BLE.
  • Client: Either the Silicon Labs Si Connect app on a phone or a Raspberry Pi 5 running a Python BLE script.

Problem:

When I establish a BLE connection and then disconnect the client improperly (e.g., by turning off Bluetooth on the phone or Raspberry Pi), the gecko_evt_le_connection_closed_id event does not trigger on the marker.

As a result:
  • The marker continues attempting to send notifications via gecko_cmd_gatt_server_send_characteristic_notification.
  • The system doesn’t reset the connection state or return to advertising mode as expected.

What’s the best practice to detect and handle unexpected client disconnects (such as power off or Bluetooth off) on a BLE GATT server using BGM121 and the Gecko stack?

Would appreciate any advice or pointers — thanks!
 

crugorocks

Joined May 1, 2025
31
Lower the supervision timeout when establishing the connection. A supervision timeout of 1–2 seconds (e.g., 100–200 units) is reasonable for most applications.
 

Thread Starter

BigShawarma

Joined Jan 20, 2025
7
case gecko_evt_le_connection_opened_id:
SLEEP_SleepBlockBegin(sleepEM2);
connectionNum = evt->data.evt_le_connection_opened.connection;
GOTO_SLEEP = false;
initGyro();
initMagno();
gecko_cmd_le_connection_set_parameters(
connectionNum,
80, // Min interval (100ms)
80, // Max interval (100ms)
0, // Slave latency
100 // Supervision timeout (100 * 10ms = 1 second)
);
break;

this is the section i am trying to use the supervision timeout.

how should i use it properly? maybe i don't use it right.
 
Top