cancel
Showing results for 
Search instead for 
Did you mean: 

How to update BLE sensor demo example code value

Nikhil Gayke
Associate III

Hi @Sebastien DENOUAL​ ​ I have example code BLE sensor demo in that they have 3 sensor value and one free fall characteristics. One is acceleration , temp, press, and free fall.

The acceleration sensor value is Conntiniously updating over the app one we enable the notifications is enable. But the temp and press value is read only they are not updating over app one we enable the notifications. I wanted to update temp and pressure value Continuesly once we enable the notifications. How I can do that in example code. What change I have to make in BLE sensor demo example. ​@Sebastien DENOUAL​ @Salvo​ @Salvatore DI SALVO​ 

1 ACCEPTED SOLUTION

Accepted Solutions
Sebastien DENOUAL
ST Employee

HI @Nikhil Gayke​ ,

This code use a Virtual timer - It allow to push snesor data only when timer expired (every x ms)

Once timer expired, it push sensor data over BLE and start again timer.

Regards,

Sebastien.

View solution in original post

8 REPLIES 8
Sebastien DENOUAL
ST Employee

Hi @Nikhil Gayke​ ,

To update temperature and pressure : you need to call Temp_update() and Press_Update() function.

Those functions are sending notification to the associated characteristic.

You may also have a look to "BLE_SensorDemo_BlueMSapp" , this code example is more complete vs BLE_SensorDemo and able to discuss with "ST BLE Sensor smartphone" App

Regards,

Sebastien.

Nikhil Gayke
Associate III

Hi Thank you @Sebastien DENOUAL​ 

Can i know what is the use of  

/* Update sensor value */

 if (sensorTimer_expired) {

  sensorTimer_expired = FALSE;

  if( HAL_VTIMER_StartTimerMs(&sensorTimerHandle, acceleration_update_rate) != BLE_STATUS_SUCCESS)

   sensorTimer_expired = TRUE;

  if(connected) {

}

this function in BLE sensor Example code @Salvo​ @Salvatore DI SALVO​ @Sebastien DENOUAL​ 

Sebastien DENOUAL
ST Employee

HI @Nikhil Gayke​ ,

This code use a Virtual timer - It allow to push snesor data only when timer expired (every x ms)

Once timer expired, it push sensor data over BLE and start again timer.

Regards,

Sebastien.

Nikhil Gayke
Associate III

Hi @Sebastien DENOUAL​ 

as mention in data sheet the data rate supported are

Data rate supported: 2 Mbps, 1 Mbps, 500 kbps and 125 kbps

from where we can set above data rate and what is the default data rate.

@Salvo​ @Salvatore DI SALVO​ @Sebastien DENOUAL​ 

Nikhil Gayke
Associate III

I have i2c based sensor working at 400Khz . i want to send the data continuously over BLE with 400khz frequency. is the i have to disable virtual time or anything else i have to do?@Salvatore DI SALVO​ @Sebastien DENOUAL​ @Salvo​ 

Nikhil Gayke
Associate III

I have 40 byte of sensor data that i want to transfer BLE at a time. is the i have to transmit 20 byte first then again 20 byte or i have to use extended data length for 40 byte how we can achieve this.

and how i can analyze throughput means how many bits send per second. or how can i determine data rate.

@Sebastien DENOUAL​ @Salvatore DI SALVO​ @Salvo​ 

Nikhil Gayke
Associate III

Hi @Sebastien DENOUAL​  waiting for replay.

@Sebastien DENOUAL​ 

Sebastien DENOUAL
ST Employee

Hi @Nikhil Gayke​ ,

Most of your latest questions are linked to your application choice. It's up to you to decide which Phy you want to use according your constraints (Coded Phy long range, legacy 1Mbps or 2Mbps). Of course, you need to consider what remote smartphone is able to support.

FYI, code examples are available in SDK :

  • BLE_throughput : 2mbps
  • BLE_RC_LongRange : LR coded phy s=8 (125kbps)

Regards,

Sebastien.