cancel
Showing results for 
Search instead for 
Did you mean: 

How to Change Sampling Frequency for ST BLE Sensor App

Tunahan
Associate

Hello STM32 Community,

I’m currently working with the STEVAL-PROTEUS1 evaluation board, which integrates an STM32WB5MMG microcontroller and an IIS2DLPC MEMS accelerometer. I’m using the board together with the ST BLE Sensor mobile app, and it works great out-of-the-box for streaming sensor data over BLE.

However, I’d like to change the sampling frequency (ODR) of the onboard accelerometer to suit my specific application needs. For example, I want to increase the data rate to 800 Hz, instead of the default (which seems to be 25 Hz or 50 Hz).

What I’ve done So Far:

 

int32_t IIS2DLPC_Init(IIS2DLPC_Object_t *pObj)

{

  /* Enable register address automatically incremented during a multiple byte

  access with a serial interface. */

  if (iis2dlpc_auto_increment_set(&(pObj->Ctx), PROPERTY_ENABLE) != IIS2DLPC_OK)

  {

    return IIS2DLPC_ERROR;

  }

  /* Enable BDU */

  if (iis2dlpc_block_data_update_set(&(pObj->Ctx), PROPERTY_ENABLE) != IIS2DLPC_OK)

  {

    return IIS2DLPC_ERROR;

  }

  /* FIFO mode selection */

  if (iis2dlpc_fifo_mode_set(&(pObj->Ctx), IIS2DLPC_BYPASS_MODE) != IIS2DLPC_OK)

  {

    return IIS2DLPC_ERROR;

  }

  /* Power mode selection */

  if (iis2dlpc_power_mode_set(&(pObj->Ctx), IIS2DLPC_HIGH_PERFORMANCE) != IIS2DLPC_OK)

  {

    return IIS2DLPC_ERROR;

  }

  /* Select default output data rate. */

  pObj->acc_odr = 800.0f;

  /* Select default operating mode. */

  pObj->acc_operating_mode = IIS2DLPC_HIGH_PERFORMANCE_MODE;

  /* Select default low noise (disabled). */

  pObj->acc_low_noise = IIS2DLPC_LOW_NOISE_DISABLE;

 

  /* Output data rate selection - power down. */

  if (iis2dlpc_data_rate_set(&(pObj->Ctx), IIS2DLPC_XL_ODR_800Hz) != IIS2DLPC_OK)

  {

    return IIS2DLPC_ERROR;

  }

  /* Full scale selection. */

  if (iis2dlpc_full_scale_set(&(pObj->Ctx), IIS2DLPC_2g) != IIS2DLPC_OK)

  {

    return IIS2DLPC_ERROR;

  }

  pObj->is_initialized = 1;

  return IIS2DLPC_OK;

}

 

I’m Trying to Achieve:

  • Stream real-time accelerometer data at 800 Hz over BLE to a mobile device using the ST BLE Sensor app.

  • Maintain stable BLE communication without data loss or overflow.

Any guidance, example code snippets, or references to documentation would be greatly appreciated. I believe others working with STEVAL-PROTEUS1 and similar BLE sensor nodes might benefit from this as well.

Thanks in advance!

1 REPLY 1
Federica Bossi
ST Employee

Hi @Tunahan ,

The official firmware also supports ODR of 800Hz, have you tried changing the ODR via app instead of modifying the code?

In order 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.