Nrf52833DK with bmi 270 sample (zephyr/samples/bmi270).
The data has always been odd
ACC data is too high & Gyro data is too low. The Gyro data flips between -1.99 and 0 while sitting stationary...
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
0.360338 -4.770722 -10.803591 0.002396 -1.995473 0.009055
0.358542 -4.786884 -10.823344 -1.979760 0.018110 0.000266
0.366324 -4.810228 -10.831125 -1.992543 0.004527 0.004793
0.381886 -4.793468 -10.839505 -1.993609 0.005859 0.004527
0.346571 -4.764737 -10.770670 0.015180 -1.981091 0.013848
0.337592 -4.763540 -10.783839 -1.995473 0.002396 0.006391
0.348366 -4.769525 -10.800598 0.003728 -1.996538 0.007457
0.359141 -4.773715 -10.798204 0.010386 -1.988282 0.010386
0.344775 -4.753963 -10.747326 0.017311 -1.977097 0.015979
0.339987 -4.760547 -10.794613 0.006924 -1.992011 0.009321
0.345374 -4.771321 -10.821548 -1.994674 0.001597 0.005859
1.004398 -2.345557 -10.461809 0.000532 -1.738470 0.675930
-1.707899 -13.749095 -3.770332 -1.654578 -1.520084 -1.389053
2.729473 0.405829 -8.105478 0.123041 -2.347459 7.974544
6.067690 8.081275 -10.885595 -2.647873 2.707185 7.334567
-9.189070 -15.927651 -8.346103 1.256783 -2.291797 5.264430
7.710163 10.682056 -10.482758 0.550492 -1.797594 -7.793582
Is there a way to change
Fullscreen
1
sensor_channel_get(dev, SENSOR_CHAN_ACCEL_XYZ, acc);
So that it does not run the math to change the values to m/s2? I just want the hex value from the memory location.
Please, also, help with what the new fprint would look like if that changed:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
struct sensor_value acc[3], gyr[3];
// struct sensor_value temperature;
sensor_sample_fetch(dev);
sensor_channel_get(dev, SENSOR_CHAN_ACCEL_XYZ, acc);
sensor_channel_get(dev, SENSOR_CHAN_GYRO_XYZ, gyr);
// sensor_channel_get(dev, SENSOR_CHAN_AMBIENT_TEMP, &temperature);
printf(" %d.%06d %d.%06d %d.%06d %d.%06d %d.%06d %d.%06d \n",
acc[0].val1, acc[0].val2,
acc[1].val1, acc[1].val2,
acc[2].val1, acc[2].val2,
gyr[0].val1, gyr[0].val2,
gyr[1].val1, gyr[1].val2,
gyr[2].val1, gyr[2].val2);
}
Main C.
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Copyright (c) 2021 Bosch Sensortec GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <drivers/sensor.h>
#include <stdio.h>
#include <sys/printk.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/gpio.h>
/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)
#if DT_NODE_HAS_STATUS(LED0_NODE, okay)
#define LED0 DT_GPIO_LABEL(LED0_NODE, gpios)
#define PIN DT_GPIO_PIN(LED0_NODE, gpios)
#define FLAGS DT_GPIO_FLAGS(LED0_NODE, gpios)
prj.conf
Fullscreen
1
2
3
4
CONFIG_STDOUT_CONSOLE=y
CONFIG_I2C=y
CONFIG_SENSOR=y
CONFIG_BMI270=y
app.overlay
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
* Copyright (c) 2021 Bosch Sensortec GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
&arduino_i2c {
status = "okay";
bmi270@68 {
compatible = "bosch,bmi270";
reg = <0x68>;
label = "BMI270";
};
};