Main Content

ICM20948 IMU Sensor

Measure linear acceleration, angular velocity, magnetic field, and temperature from ICM20948 IMU sensor

Since R2025a

Add-On Required: This feature requires the Embedded Coder Support Package for STMicroelectronics STM32 Processors add-on.

  • block icon for ICM20948 IMU sensor

Libraries:
Embedded Coder Support Package for STMicroelectronics STM32 Processors / Sensors / IMU Sensors

Description

The ICM20948 IMU Sensor block outputs the values of linear acceleration, angular velocity, and magnetic field strength along x-, y- and z- axes as measured by the ICM20948 IMU sensor connected to an STM32 processor. The block also outputs the temperature read by the ICM20948 IMU sensor.

Examples

Ports

Output

expand all

The Acceleration port outputs acceleration in m/s2 along the x-, y-, and z- axes of the sensor as a n-by-3 vector.

Dependencies

To enable this port, select the Acceleration (m/s2) parameter.

Data Types: single (default) | double

The Angular Rate port outputs angular velocity in radians per second (rad/s) along the x-, y-, and z- axes of the sensor as a n-by-3 vector.

Dependencies

To enable this port, select the Angular Velocity (rad/s) parameter.

Data Types: single (default) | double

The Magnetic Field port outputs magnetic field strength in µT along the x-, y-, and z- axes of the sensor as a n-by-3 vector..

Dependencies

To enable this port, select the Magnetic Field (µT) parameter.

Data Types: single (default) | double

Temperature (in ℃) measured by the ICM20948 IMU sensor connected to an STM32 processor.

Dependencies

To enable this port, select the Temperature (℃) parameter.

Data Types: single | double

Status of acceleration, angular rate, magnetometer, and temperature measurements along the three axes, returned as a 1-by-2 vector of uint8 values. First element in the vector represents the status of acceleration, angular rate, and temperature measurements and the second element represents the status of magnetometer measurements. The block outputs status as 0s or 1s. 0 indicates that the data read is new and 1 indicates that the data read is not new.

Dependencies

To enable this port, select the Status parameter.

Note

The Status parameter is disabled if you select the Generate data ready interrupt parameter.

Data Types: uint8

Parameters

expand all

Specify the I2C module on the STM32 processor to communicate with sensor peripherals.

The I2C address of the ICM20948 IMU sensor from which the block reads the data. The ICM20948 sensor can have two I2C addresses depending on the logic level on pin AD0 of the sensor.

Pin NamePin StateI2C Address
AD0Low0x68
High0x69

Select this parameter to generate an interrupt on pin INT1 of the sensor when data is ready. Using this option, you can trigger other subsystems to perform any action.

Select the logic level for the INT1 pin as Active high or Active low.

Dependencies

To enable this parameter, select the Generate data ready interrupt parameter.

Select this parameter to enable Acceleration output port.

Select this parameter to enable Angular Rate output port.

Select this parameter to enable Magnetic Field output port.

Select this parameter to enable Temperature output port.

Select this parameter to set Status as one of the output ports. This parameter is disabled if you select the Generate data ready interrupt parameter.

Specify the data type for the acceleration, angular rate, magnetic field, and temperature outputs.

Specify how often the block reads the data from the ICM20948 IMU sensor. When you set this parameter to -1, Simulink determines the best sample time for the block based on the block's context within the model. The output sample time is the product of the values you specify in Sample time parameter.

Accelerometer Settings

Select the range of for measuring acceleration.

Specify the output data rate as a scalar in the range 0.3 to 1125 Hz. Accelerometer data output rate in Hz is determined by the following calculation.

1125/(1+ACCEL_SMPLRT_DIV)Hz, where ACCEL_SMPLRT_DIV is 0,1,2,...4095.

Depending on the output data rate specified on the block mask, ACCEL_SMPLRT_DIV is set on the sensor.

Specify the 3 dB bandwidth of the accelerometer lowpass filter.

Gyroscope Settings

Specify the maximum angular velocity that the gyroscope can measure per second.

Specify the output data rate as a scalar in the range 4.4 Hz to 1125 Hz.

Gyroscope data output rate in Hz is determined by the following calculation.

1125/(1+GYRO_SMPLRT_DIV)Hz, where GYRO_SMPLRT_DIV is 0,1,2,...255.

Depending on the output data rate specified on the block mask, GYRO_SMPLRT_DIV will be set on the sensor.

Specify the 3 dB bandwidth of the gyroscope lowpass filter.

Magnetometer Settings

Select the output data rate at which magnetometer data is sampled.

Temperature sensor Settings

Specify the noise bandwidth (NBW) of the temperature lowpass filter in Hz.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2025a