FIFO is always 10-bit

This commit is contained in:
William Clark 2023-12-26 07:42:55 +00:00
parent b27722f466
commit ecf00e3584
7 changed files with 21 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -49,6 +49,10 @@ x: 0.5480, y: -0.8800, z: -0.0720 mag: 1.0392
x: 0.5480, y: -0.8800, z: -0.0800 mag: 1.0398 x: 0.5480, y: -0.8800, z: -0.0800 mag: 1.0398
x: 0.5480, y: -0.8960, z: -0.0960 mag: 1.0547 x: 0.5480, y: -0.8960, z: -0.0960 mag: 1.0547
``` ```
> ### Notes
> FIFO is always and only 10-bit
### Noise at 2G ### Noise at 2G
![DC noise at 2G](.gitea/graph-2g.png) ![DC noise at 2G](.gitea/graph-2g.png)

View File

@ -294,8 +294,19 @@ int lis3dh_read_fifo(lis3dh_t *lis3dh, struct lis3dh_fifo_data *fifo) {
int err = 0; int err = 0;
int i, idx; int i, idx;
scale = acc_shift(lis3dh); /* FIFO is always 10-bit */
sens = acc_sensitivity(lis3dh); scale = 6;
/* normal mode */
if (lis3dh->cfg.range == LIS3DH_FS_2G) {
sens = 4;
} else if (lis3dh->cfg.range == LIS3DH_FS_4G) {
sens = 8;
} else if (lis3dh->cfg.range == LIS3DH_FS_8G) {
sens = 16;
} else { /* 16G */
sens = 48;
}
/* fifo buffer is max 32 */ /* fifo buffer is max 32 */
fifo->size = lis3dh->cfg.fifo.fth > 32 ? 32 : lis3dh->cfg.fifo.fth; fifo->size = lis3dh->cfg.fifo.fth > 32 ? 32 : lis3dh->cfg.fifo.fth;

11
plot.gp
View File

@ -7,20 +7,17 @@ set key box opaque
set ylabel "|[x y z]| - 1g" set ylabel "|[x y z]| - 1g"
set xlabel "Samples over time" set xlabel "Samples over time"
set yrange [-0.2:0.2] set yrange [-0.3:0.1]
n(g) = g - 1.0 n(g) = g - 1.0
do for [g in "2g 4g 8g 16g"] { do for [g in "2g 4g 8g 16g"] {
name = sprintf("graph-%s", g) name = sprintf("graph-%s", g)
out = sprintf("%s.png", name) out = sprintf("%s.png", name)
stub = sprintf("data/hr_%s_", g) stub = sprintf("data/fifo_%s_", g)
set title sprintf("[%s + HR] comparison of ODR setting effect on magnitude of [x y z] acc vector (- 1g)", g) set title sprintf("[%s FIFO] comparison of ODR setting effect on magnitude of [x y z] acc vector (- 1g)", g)
set output out set output out
plot stub."1.txt" u n(4) w p ps 0.3 t "1 Hz", \ plot stub."50.txt" u n(4) w p ps 0.3 t "50 Hz", \
stub."10.txt" u n(4) w p ps 0.3 t "10 Hz", \
stub."25.txt" u n(4) w p ps 0.3 t "25 Hz", \
stub."50.txt" u n(4) w p ps 0.3 t "50 Hz", \
stub."100.txt" u n(4) w p ps 0.3 t "100 Hz", \ stub."100.txt" u n(4) w p ps 0.3 t "100 Hz", \
stub."200.txt" u n(4) w p ps 0.3 t "200 Hz", \ stub."200.txt" u n(4) w p ps 0.3 t "200 Hz", \
stub."400.txt" u n(4) w p ps 0.3 t "400 Hz", \ stub."400.txt" u n(4) w p ps 0.3 t "400 Hz", \