Hi,
I'm working with a nordic thingy:52 and SDK thingylib on Android.
The issue I'm facing is that the real sampling frequency, compared to the one indicated by the SDK and the Nordic documentation (which is 200Hz) is different (**real 50-70Hz**).
In fact, inside the SDK, in the `ThingyUtils.java` file, there are two minimum and maximum offsets:
```java
public static final int MPU_FREQ_MIN_INTERVAL = 5; //hz
public static final int MPU_FREQ_MAX_INTERVAL = 200; //hz
```
When I bind the devices in my process, I set the maximum frequency:
```java
thingySdkManager.enableMotionNotifications(device, true);
thingySdkManager.setMotionProcessingFrequency(device, ThingyUtils.MPU_FREQ_MAX_INTERVAL);
```
and, inside the `ThingyListener ` listener I print a simple log with timestamps:
```java
private ThingyListener mThingyListener = new ThingyListener() {
// other events
@Override
public void onGyroscopeValueChangedEvent(BluetoothDevice bluetoothDevice, float x, float y, float z) {
String ts = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss.SSS", Locale.getDefault()).format(new Date());
Log.d("onGyroscopeValueChangedEvent", "ts:" + ts);
}
};
```
From the logcat, if I extract a log sequence of one second, I notice that I had 61 calls to the event, so I seem to see that the sampling rate is about 16ms (50-70Hz) not 5ms (200Hz) as expected.
Is there some kind of problem where I interface with Nordic, or is the maximum sampling frequency indicated, 200hz, not really the real one? How can I get as close as possible to 200Hz?
I also tried to set the minum values to the connection parameters and the advertising parameters.
The phone I'm using is an Oneplus6, with android 10, but I tried also two other phones of different model, and I get the same result.
Thanks.
---
logcat:
```log
2020-09-23 19:21:40.008 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.007
2020-09-23 19:21:40.011 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.011
2020-09-23 19:21:40.039 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.038
2020-09-23 19:21:40.043 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.043
2020-09-23 19:21:40.070 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.069
2020-09-23 19:21:40.071 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.070
2020-09-23 19:21:40.098 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.097
2020-09-23 19:21:40.099 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.099
2020-09-23 19:21:40.130 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.129
2020-09-23 19:21:40.132 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.131
2020-09-23 19:21:40.162 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.161
2020-09-23 19:21:40.191 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.190
2020-09-23 19:21:40.194 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.193
2020-09-23 19:21:40.217 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.217
2020-09-23 19:21:40.220 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.220
2020-09-23 19:21:40.251 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.251
2020-09-23 19:21:40.253 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.253
2020-09-23 19:21:40.279 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.279
2020-09-23 19:21:40.282 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.282
2020-09-23 19:21:40.310 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.309
2020-09-23 19:21:40.312 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.312
2020-09-23 19:21:40.340 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.339
2020-09-23 19:21:40.372 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.372
2020-09-23 19:21:40.375 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.374
2020-09-23 19:21:40.400 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.400
2020-09-23 19:21:40.426 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.425
2020-09-23 19:21:40.433 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.432
2020-09-23 19:21:40.456 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.456
2020-09-23 19:21:40.459 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.459
2020-09-23 19:21:40.485 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.485
2020-09-23 19:21:40.492 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.492
2020-09-23 19:21:40.494 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.494
2020-09-23 19:21:40.518 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.517
2020-09-23 19:21:40.520 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.519
2020-09-23 19:21:40.548 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.548
2020-09-23 19:21:40.551 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.550
2020-09-23 19:21:40.580 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.580
2020-09-23 19:21:40.582 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.582
2020-09-23 19:21:40.610 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.609
2020-09-23 19:21:40.612 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.611
2020-09-23 19:21:40.644 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.644
2020-09-23 19:21:40.666 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.666
2020-09-23 19:21:40.672 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.671
2020-09-23 19:21:40.696 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.696
2020-09-23 19:21:40.701 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.701
2020-09-23 19:21:40.725 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.725
2020-09-23 19:21:40.731 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.731
2020-09-23 19:21:40.756 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.755
2020-09-23 19:21:40.760 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.760
2020-09-23 19:21:40.787 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.787
2020-09-23 19:21:40.792 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.791
2020-09-23 19:21:40.820 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.820
2020-09-23 19:21:40.846 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.846
2020-09-23 19:21:40.848 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.848
2020-09-23 19:21:40.877 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.877
2020-09-23 19:21:40.880 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.880
2020-09-23 19:21:40.906 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.905
2020-09-23 19:21:40.913 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.912
2020-09-23 19:21:40.940 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.939
2020-09-23 19:21:40.942 22808-22808/it.chiarani.nordic_data_collector D/onGyroscopeValueChangedEvent: ts:23-09-2020 19:21:40.942
```