DevLab_ICM20948 1.0.2
ICM-20948 9-Axis Motion Sensor Driver
Loading...
Searching...
No Matches
test2.ino File Reference

Extended accelerometer DLPF, full-scale, and averaging sweep. More...

#include <Wire.h>
#include <DevLab_ICM20948.h>
Include dependency graph for test2.ino:

Go to the source code of this file.

Classes

struct  configDLPF
 Gyroscope DLPF divider and timing configuration. More...
 

Macros

#define SDA_PIN   6
 I2C SDA pin used by the example board.
 
#define SCL_PIN   7
 I2C SCL pin used by the example board.
 
#define I2C_FREQ   400000UL
 I2C bus speed in hertz.
 
#define ICM_ADDR   0x69
 ICM-20948 I2C address selected by the AD0 pin.
 

Functions

void printLinea ()
 Print a separator line to Serial.
 
void printDobleLinea ()
 Print a double separator line to Serial.
 
void firstStage ()
 Verify the IMU identity register.
 
bool applySettings (uint8_t fs_idx, const configDLPF &cfg, uint8_t avg)
 Apply one accelerometer full-scale, DLPF, and averaging configuration.
 
void runSweep ()
 Run the full accelerometer validation matrix and print samples.
 
void setup ()
 Initialize I2C, reset/wake the IMU, enable sensors, and start sweep.
 
void loop ()
 Optional post-sweep loop for manual accelerometer reads.
 

Variables

const configDLPF configsDLPF []
 Accelerometer DLPF configurations exercised by this sweep.
 
const uint8_t N_DLPF = sizeof(configsDLPF) / sizeof(configsDLPF[0])
 Number of accelerometer DLPF configurations.
 
const ICM20948_Accel_FullScale accelCfg []
 Accelerometer full-scale ranges exercised by the sweep.
 
const char * etiquetasAccelCfg [] = { "+-2G","+-4G","+-8G","+-16G" }
 Text labels matching accelCfg.
 
const uint8_t N_FS = 4
 Number of accelerometer full-scale ranges.
 
const ICM20948_Accel_DLPFCFG accelDLPF []
 Accelerometer DLPF enum values matching configsDLPF.
 
const ICM20948_Accel_Average accelAVG []
 Accelerometer averaging settings exercised by the sweep.
 
const char * etiquetasAccelAVG [] = { "14","8","16","32" }
 Text labels matching accelAVG.
 
const uint8_t N_AVG = 4
 Number of accelerometer averaging settings.
 
const uint16_t accelSR []
 Raw accelerometer sample-rate divider values for experiments.
 
const char * etiquetasSR []
 Text labels matching accelSR output data rates.
 
DevLab_ICM20948 imu
 Global ICM-20948 driver instance.
 
uint8_t total_pass = 0
 Count of validation passes reserved for future checks.
 
uint8_t total_fail = 0
 Count of validation failures reserved for future checks.
 
uint8_t total_warn = 0
 Count of validation warnings reserved for future checks.
 

Detailed Description

Extended accelerometer DLPF, full-scale, and averaging sweep.

Author
Jonathan Mejorado Lopez

Runs a larger I2C validation matrix for the DevLab ICM-20948 accelerometer and prints CSV-like samples for later analysis.

Definition in file test2.ino.

Macro Definition Documentation

◆ I2C_FREQ

#define I2C_FREQ   400000UL

I2C bus speed in hertz.

Definition at line 20 of file test2.ino.

◆ ICM_ADDR

#define ICM_ADDR   0x69

ICM-20948 I2C address selected by the AD0 pin.

Definition at line 22 of file test2.ino.

◆ SCL_PIN

#define SCL_PIN   7

I2C SCL pin used by the example board.

Definition at line 18 of file test2.ino.

◆ SDA_PIN

#define SDA_PIN   6

I2C SDA pin used by the example board.

Definition at line 16 of file test2.ino.

Function Documentation

◆ applySettings()

bool applySettings ( uint8_t  fs_idx,
const configDLPF cfg,
uint8_t  avg 
)

Apply one accelerometer full-scale, DLPF, and averaging configuration.

Parameters
fs_idxIndex into accelCfg.
cfgDLPF timing and divider configuration.
avgIndex into accelAVG.
Returns
true if all configuration writes succeeded, otherwise false.

Definition at line 150 of file test2.ino.

Here is the call graph for this function:

◆ firstStage()

void firstStage ( )

Verify the IMU identity register.

Definition at line 124 of file test2.ino.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loop()

void loop ( )

Optional post-sweep loop for manual accelerometer reads.

Definition at line 299 of file test2.ino.

◆ printDobleLinea()

void printDobleLinea ( )

Print a double separator line to Serial.

Definition at line 117 of file test2.ino.

Here is the caller graph for this function:

◆ printLinea()

void printLinea ( )

Print a separator line to Serial.

Definition at line 115 of file test2.ino.

◆ runSweep()

void runSweep ( )

Run the full accelerometer validation matrix and print samples.

Definition at line 184 of file test2.ino.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup()

void setup ( )

Initialize I2C, reset/wake the IMU, enable sensors, and start sweep.

Definition at line 251 of file test2.ino.

Here is the call graph for this function:

Variable Documentation

◆ accelAVG

◆ accelCfg

◆ accelDLPF

◆ accelSR

const uint16_t accelSR[]
Initial value:
= {
0, 1, 3, 5, 7, 10, 15, 22, 31, 63, 127, 255, 513, 1022, 2044, 4095
}

Raw accelerometer sample-rate divider values for experiments.

Definition at line 94 of file test2.ino.

◆ configsDLPF

const configDLPF configsDLPF[]
Initial value:
= {
{ 0, 0, 265.0f, 1125.0f, "246 ; 265 ; 1125 " },
{ 1, 0, 265.0f, 1125.0f, "246 ; 265 ; 1125 " },
{ 2, 1, 136.0f, 562.5f, "111 ; 136 ; 562 " },
{ 3, 2, 68.8f, 375.0f, "50 ; 69 ; 375 " },
{ 4, 7, 34.4f, 140.6f, "24 ; 34 ; 141 " },
{ 5, 15, 17.0f, 70.3f, "12 ; 17 ; 70 " },
{ 6, 29, 8.3f, 37.5f, "6 ; 8 ; 35 " },
{ 7, 0, 499.0f, 1125.0f, "473 ; 499 ; 1125 " },
}

Accelerometer DLPF configurations exercised by this sweep.

Definition at line 42 of file test2.ino.

◆ etiquetasAccelAVG

const char* etiquetasAccelAVG[] = { "14","8","16","32" }

Text labels matching accelAVG.

Definition at line 90 of file test2.ino.

◆ etiquetasAccelCfg

const char* etiquetasAccelCfg[] = { "+-2G","+-4G","+-8G","+-16G" }

Text labels matching accelCfg.

Definition at line 66 of file test2.ino.

◆ etiquetasSR

const char* etiquetasSR[]
Initial value:
= {
"1125.0","562.5","281.3","187.5","140.6","102.3","70.3",
"48.9","35.2","17.6","8.8","4.4","2.2","1.1","0.55","0.27"
}

Text labels matching accelSR output data rates.

Definition at line 98 of file test2.ino.

◆ imu

Global ICM-20948 driver instance.

Definition at line 105 of file test2.ino.

◆ N_AVG

const uint8_t N_AVG = 4

Number of accelerometer averaging settings.

Definition at line 92 of file test2.ino.

◆ N_DLPF

const uint8_t N_DLPF = sizeof(configsDLPF) / sizeof(configsDLPF[0])

Number of accelerometer DLPF configurations.

Definition at line 53 of file test2.ino.

◆ N_FS

const uint8_t N_FS = 4

Number of accelerometer full-scale ranges.

Definition at line 68 of file test2.ino.

◆ total_fail

uint8_t total_fail = 0

Count of validation failures reserved for future checks.

Definition at line 109 of file test2.ino.

◆ total_pass

uint8_t total_pass = 0

Count of validation passes reserved for future checks.

Definition at line 107 of file test2.ino.

◆ total_warn

uint8_t total_warn = 0

Count of validation warnings reserved for future checks.

Definition at line 111 of file test2.ino.