Skip to main content
Associate
January 16, 2024
Solved

Send large chunks of data via BLE

  • January 16, 2024
  • 2 replies
  • 1576 views

Hello,

I want to use the SensorTile.box to collect IMU data over BLE. I tried modifying the BLESensors source code to suit my requirements (by increasing the characteristic size etc.). But the ST BLE Sensor app doesn't seem to support this. I only receive one sample at a time. Is there any way to do this? 

Code Snippet 1:

#define BUFFER_SIZE ( 32 )
if (InertialFeaturesEnabled.AccIsEnable == 1U)
{
for(int i = 0; i < BUFFER_SIZE; i++)
{
STORE_LE_16(buff + BuffPos, ((uint16_t)Acc[i].Axis_x));
BuffPos += 2U;
STORE_LE_16(buff + BuffPos, ((uint16_t)Acc[i].Axis_y));
BuffPos += 2U;
STORE_LE_16(buff + BuffPos, ((uint16_t)Acc[i].Axis_z));
BuffPos += 2U;
}
}

if (InertialFeaturesEnabled.GyroIsEnable == 1U)
{
for(int i = 0; i < BUFFER_SIZE; i++)
{
STORE_LE_16(buff + BuffPos, ((uint16_t)Gyro[i].Axis_x));
BuffPos += 2U;
STORE_LE_16(buff + BuffPos, ((uint16_t)Gyro[i].Axis_y));
BuffPos += 2U;
STORE_LE_16(buff + BuffPos, ((uint16_t)Gyro[i].Axis_z));
BuffPos += 2U;
}
}
ret = ACI_GATT_UPDATE_CHAR_VALUE(&BleCharInertial, 0, InertialCharSize, buff);

 Code Snippet 2:

if (AccEnable == 1U)
{
BleCharPointer->uuid[14] |= 0x80U;
InertialCharSize += BUFFER_SIZE * 3U * 2U;
#if (BLE_DEBUG_LEVEL>1)
BLE_MANAGER_PRINTF("\t--> Accelerometer feature enabled\r\n");
#endif /* (BLE_DEBUG_LEVEL>1) */
}
/* Enables BLE gyroscope feature */
if (GyroEnable == 1U)
{
BleCharPointer->uuid[14] |= 0x40U;
InertialCharSize += BUFFER_SIZE * 3U * 2U;
#if (BLE_DEBUG_LEVEL>1)
BLE_MANAGER_PRINTF("\t--> Gyroscope feature enabled\r\n");
#endif /* (BLE_DEBUG_LEVEL>1) */
}
This topic has been closed for replies.
Best answer by Federica Bossi

Hi @Flare ,

Welcome to ST Community!

The ST BLE Sensor App by definition does not support more than one sample per characteristic. You could check the definition of the characteristic used for sending IMU data here in section 6.As an alternative, you could increase the frequency of sending samples, to have bigger data chunks at the same time as before.

If you need a custom application that sends more than one sample, you should modify not only the board FW, but also the SDK code and the application source code accordingly. In this case however the application would only work with your customizations.  

2 replies

Federica Bossi
Federica BossiBest answer
Technical Moderator
March 7, 2024

Hi @Flare ,

Welcome to ST Community!

The ST BLE Sensor App by definition does not support more than one sample per characteristic. You could check the definition of the characteristic used for sending IMU data here in section 6.As an alternative, you could increase the frequency of sending samples, to have bigger data chunks at the same time as before.

If you need a custom application that sends more than one sample, you should modify not only the board FW, but also the SDK code and the application source code accordingly. In this case however the application would only work with your customizations.  

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.
Andrew Neil
Super User
March 7, 2024

Please use this button to properly post source code:

AndrewNeil_0-1709824062519.png

 

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.