RegForge

All parts / MPU6050

MPU6050 register map

Six-axis MEMS gyroscope and accelerometer with I2C — InvenSense

25 registers I2C I²C 0x68, 0x69 8-bit reg addresses 68% bit coverage not yet human-verified
I²C address conflict. On its default address(es) this part collides with DS1307 (0x68); DS3231 (0x68); PCA9685 (0x68, 0x69). You cannot put them on the same bus without changing a strap pin, using an I²C multiplexer, or moving one to a second bus. See the full address map.

Get it as a C header

pip install regforge
regforge gen MPU6050 --out ./src --driver --tests

Writes mpu6050_regs.h with every address, mask and shift below, a bus-agnostic driver skeleton, and a file of compile-time assertions that make your compiler check the bit arithmetic. No API key needed — this part ships inside the package.

Not yet human-verified. Transcribed and mechanically validated — no overlapping fields, no out-of-range bits, reset values consistent with their fields — but not yet checked line-by-line against the datasheet. Verifying it is a useful half hour.

Registers

AddrRegisterAccessWidthResetDescription
0x19SMPLRT_DIVRW80x00Sample rate divider. Sample rate = gyroscope output rate / (1 + SMPLRT_DIV).
0x1ACONFIGRW80x00External frame synchronisation and digital low-pass filter configuration
0x1BGYRO_CONFIGRW80x00Gyroscope self-test and full-scale range
0x1CACCEL_CONFIGRW80x00Accelerometer self-test and full-scale range
0x23FIFO_ENRW80x00Selects which sensor measurements are loaded into the FIFO
0x37INT_PIN_CFGRW80x00INT pin behaviour and I2C bypass
0x38INT_ENABLERW80x00Interrupt enables
0x3AINT_STATUSRO80x00Interrupt status. Cleared on read.
0x3BACCEL_XOUT_HRO8—Accelerometer X-axis measurement, high byte
0x3CACCEL_XOUT_LRO8—Accelerometer X-axis measurement, low byte
0x3DACCEL_YOUT_HRO8—Accelerometer Y-axis measurement, high byte
0x3EACCEL_YOUT_LRO8—Accelerometer Y-axis measurement, low byte
0x3FACCEL_ZOUT_HRO8—Accelerometer Z-axis measurement, high byte
0x40ACCEL_ZOUT_LRO8—Accelerometer Z-axis measurement, low byte
0x41TEMP_OUT_HRO8—Temperature measurement, high byte
0x42TEMP_OUT_LRO8—Temperature measurement, low byte
0x43GYRO_XOUT_HRO8—Gyroscope X-axis measurement, high byte
0x44GYRO_XOUT_LRO8—Gyroscope X-axis measurement, low byte
0x45GYRO_YOUT_HRO8—Gyroscope Y-axis measurement, high byte
0x46GYRO_YOUT_LRO8—Gyroscope Y-axis measurement, low byte
0x47GYRO_ZOUT_HRO8—Gyroscope Z-axis measurement, high byte
0x48GYRO_ZOUT_LRO8—Gyroscope Z-axis measurement, low byte
0x6BPWR_MGMT_1RW80x40Power mode and clock source. Note the reset value: SLEEP is set, so the device must be woken before it will produce data.
0x6CPWR_MGMT_2RW80x00Low-power wake rate and per-axis standby
0x75WHO_AM_IRO80x68Device identity. Contains the upper six bits of the I2C address; reads 0x68.

Bit layouts

Drawn MSB-first, the way the datasheet draws them. [7:5] means shift 5, width 3, mask 0xE0 — this is the notation that costs people a day when they read it backwards.

CONFIG  @  0x1A  —  2 fields
—7
—6
EXT_SYNC_SET[5:3]
DLPF_CFG[2:0]
BitsFieldAccessMaskResetDescription
[5:3]EXT_SYNC_SETRW0x380x00FSYNC pin sampling configuration
[2:0]DLPF_CFGRW0x070x00Digital low-pass filter bandwidth
GYRO_CONFIG  @  0x1B  —  4 fields
XG_ST[7]
YG_ST[6]
ZG_ST[5]
FS_SEL[4:3]
—2
—1
—0
BitsFieldAccessMaskResetDescription
[7]XG_STRW0x800x00X-axis gyro self-test
[6]YG_STRW0x400x00Y-axis gyro self-test
[5]ZG_STRW0x200x00Z-axis gyro self-test
[4:3]FS_SELRW0x180x00Gyroscope full-scale range

GYRO_CONFIG.FS_SEL values

ValueNameMeaning
0x00DPS_250+/-250 degrees per second
0x01DPS_500+/-500 degrees per second
0x02DPS_1000+/-1000 degrees per second
0x03DPS_2000+/-2000 degrees per second
ACCEL_CONFIG  @  0x1C  —  4 fields
XA_ST[7]
YA_ST[6]
ZA_ST[5]
AFS_SEL[4:3]
—2
—1
—0
BitsFieldAccessMaskResetDescription
[7]XA_STRW0x800x00X-axis accelerometer self-test
[6]YA_STRW0x400x00Y-axis accelerometer self-test
[5]ZA_STRW0x200x00Z-axis accelerometer self-test
[4:3]AFS_SELRW0x180x00Accelerometer full-scale range

ACCEL_CONFIG.AFS_SEL values

ValueNameMeaning
0x00G_2+/-2 g
0x01G_4+/-4 g
0x02G_8+/-8 g
0x03G_16+/-16 g
FIFO_EN  @  0x23  —  5 fields
TEMP_FIFO_EN[7]
XG_FIFO_EN[6]
YG_FIFO_EN[5]
ZG_FIFO_EN[4]
ACCEL_FIFO_EN[3]
—2
—1
—0
BitsFieldAccessMaskResetDescription
[7]TEMP_FIFO_ENRW0x800x00Queue TEMP_OUT to the FIFO
[6]XG_FIFO_ENRW0x400x00Queue GYRO_XOUT to the FIFO
[5]YG_FIFO_ENRW0x200x00Queue GYRO_YOUT to the FIFO
[4]ZG_FIFO_ENRW0x100x00Queue GYRO_ZOUT to the FIFO
[3]ACCEL_FIFO_ENRW0x080x00Queue all accelerometer output to the FIFO
INT_PIN_CFG  @  0x37  —  7 fields
INT_LEVEL[7]
INT_OPEN[6]
LATCH_INT_EN[5]
INT_RD_CLEAR[4]
FSYNC_INT_LEVEL[3]
FSYNC_INT_EN[2]
I2C_BYPASS_EN[1]
—0
BitsFieldAccessMaskResetDescription
[7]INT_LEVELRW0x800x000 = active high, 1 = active low
[6]INT_OPENRW0x400x000 = push-pull, 1 = open drain
[5]LATCH_INT_ENRW0x200x000 = 50 us pulse, 1 = latched until cleared
[4]INT_RD_CLEARRW0x100x001 = any read clears the interrupt status
[3]FSYNC_INT_LEVELRW0x080x00FSYNC interrupt active level
[2]FSYNC_INT_ENRW0x040x00Enable the FSYNC pin as an interrupt source
[1]I2C_BYPASS_ENRW0x020x00Connect the auxiliary I2C bus to the main bus
INT_ENABLE  @  0x38  —  3 fields
—7
—6
—5
FIFO_OFLOW_EN[4]
I2C_MST_INT_EN[3]
—2
—1
DATA_RDY_EN[0]
BitsFieldAccessMaskResetDescription
[4]FIFO_OFLOW_ENRW0x100x00Interrupt on FIFO overflow
[3]I2C_MST_INT_ENRW0x080x00Interrupt on I2C master events
[0]DATA_RDY_ENRW0x010x00Interrupt when new sensor data is available
INT_STATUS  @  0x3A  —  3 fields
—7
—6
—5
FIFO_OFLOW_INT[4]
I2C_MST_INT[3]
—2
—1
DATA_RDY_INT[0]
BitsFieldAccessMaskResetDescription
[4]FIFO_OFLOW_INTRO0x100x00FIFO overflow occurred
[3]I2C_MST_INTRO0x080x00I2C master interrupt
[0]DATA_RDY_INTRO0x010x00New sensor data is available
PWR_MGMT_1  @  0x6B  —  5 fields
DEVICE_RESET[7]
SLEEP[6]
CYCLE[5]
—4
TEMP_DIS[3]
CLKSEL[2:0]
BitsFieldAccessMaskResetDescription
[7]DEVICE_RESETW1P0x800x00Write 1 to reset all registers; self-clearing
[6]SLEEPRW0x400x01Sleep mode. Set at reset -- clear it to start measuring.
[5]CYCLERW0x200x00Cycle between sleep and a single sample at LP_WAKE_CTRL rate
[3]TEMP_DISRW0x080x00Disable the temperature sensor
[2:0]CLKSELRW0x070x00Clock source select

PWR_MGMT_1.CLKSEL values

ValueNameMeaning
0x00INTERNAL_8MHZInternal 8 MHz oscillator
0x01PLL_X_GYROPLL with X-axis gyro reference (recommended)
0x02PLL_Y_GYROPLL with Y-axis gyro reference
0x03PLL_Z_GYROPLL with Z-axis gyro reference
0x04PLL_EXT_32KPLL with external 32.768 kHz reference
0x05PLL_EXT_19MPLL with external 19.2 MHz reference
0x07STOPStops the clock and holds the timing generator in reset
PWR_MGMT_2  @  0x6C  —  7 fields
LP_WAKE_CTRL[7:6]
STBY_XA[5]
STBY_YA[4]
STBY_ZA[3]
STBY_XG[2]
STBY_YG[1]
STBY_ZG[0]
BitsFieldAccessMaskResetDescription
[7:6]LP_WAKE_CTRLRW0xC00x00Wake-up frequency in accelerometer-only low-power mode
[5]STBY_XARW0x200x00Put the X-axis accelerometer into standby
[4]STBY_YARW0x100x00Put the Y-axis accelerometer into standby
[3]STBY_ZARW0x080x00Put the Z-axis accelerometer into standby
[2]STBY_XGRW0x040x00Put the X-axis gyro into standby
[1]STBY_YGRW0x020x00Put the Y-axis gyro into standby
[0]STBY_ZGRW0x010x00Put the Z-axis gyro into standby

Generated C header

What regforge gen MPU6050 writes for INT_PIN_CFG:

/* ------------------------------------------------------------------------ */
/* INT_PIN_CFG @ 0x37u  rw  8-bit  reset 0x00u */
/* INT pin behaviour and I2C bypass */
/* ------------------------------------------------------------------------ */

#define MPU6050_INT_PIN_CFG                            0x37u
#define MPU6050_INT_PIN_CFG_WIDTH                      8u
#define MPU6050_INT_PIN_CFG_RESET                      0x00u

/*   INT_LEVEL bits [7] rw reset 0x00u -- 0 = active high, 1 = active low */
#define MPU6050_INT_PIN_CFG_INT_LEVEL_SHIFT            7u
#define MPU6050_INT_PIN_CFG_INT_LEVEL_WIDTH            1u
#define MPU6050_INT_PIN_CFG_INT_LEVEL_MASK             0x80u
#define MPU6050_INT_PIN_CFG_INT_LEVEL_GET(reg)         (((uint8_t)(reg) & 0x80u) >> 7u)
#define MPU6050_INT_PIN_CFG_INT_LEVEL_SET(reg, val)    (((uint8_t)(reg) & (uint8_t)~0x80u) | (((uint8_t)(val) << 7u) & 0x80u))

/*   INT_OPEN bits [6] rw reset 0x00u -- 0 = push-pull, 1 = open drain */
#define MPU6050_INT_PIN_CFG_INT_OPEN_SHIFT             6u
#define MPU6050_INT_PIN_CFG_INT_OPEN_WIDTH             1u
#define MPU6050_INT_PIN_CFG_INT_OPEN_MASK              0x40u
#define MPU6050_INT_PIN_CFG_INT_OPEN_GET(reg)          (((uint8_t)(reg) & 0x40u) >> 6u)
#define MPU6050_INT_PIN_CFG_INT_OPEN_SET(reg, val)     (((uint8_t)(reg) & (uint8_t)~0x40u) | (((uint8_t)(val) << 6u) & 0x40u))

/*   LATCH_INT_EN bits [5] rw reset 0x00u -- 0 = 50 us pulse, 1 = latched until cleared */
#define MPU6050_INT_PIN_CFG_LATCH_INT_EN_SHIFT         5u
#define MPU6050_INT_PIN_CFG_LATCH_INT_EN_WIDTH         1u
#define MPU6050_INT_PIN_CFG_LATCH_INT_EN_MASK          0x20u
#define MPU6050_INT_PIN_CFG_LATCH_INT_EN_GET(reg)      (((uint8_t)(reg) & 0x20u) >> 5u)
#define MPU6050_INT_PIN_CFG_LATCH_INT_EN_SET(reg, val) (((uint8_t)(reg) & (uint8_t)~0x20u) | (((uint8_t)(val) << 5u) & 0x20u))

/*   INT_RD_CLEAR bits [4] rw reset 0x00u -- 1 = any read clears the interrupt status */
#define MPU6050_INT_PIN_CFG_INT_RD_CLEAR_SHIFT         4u
#define MPU6050_INT_PIN_CFG_INT_RD_CLEAR_WIDTH         1u
#define MPU6050_INT_PIN_CFG_INT_RD_CLEAR_MASK          0x10u
#define MPU6050_INT_PIN_CFG_INT_RD_CLEAR_GET(reg)      (((uint8_t)(reg) & 0x10u) >> 4u)
#define MPU6050_INT_PIN_CFG_INT_RD_CLEAR_SET(reg, val) (((uint8_t)(reg) & (uint8_t)~0x10u) | (((uint8_t)(val) << 4u) & 0x10u))

/*   FSYNC_INT_LEVEL bits [3] rw reset 0x00u -- FSYNC interrupt active level */
#define MPU6050_INT_PIN_CFG_FSYNC_INT_LEVEL_SHIFT      3u
#define MPU6050_INT_PIN_CFG_FSYNC_INT_LEVEL_WIDTH      1u
#define MPU6050_INT_PIN_CFG_FSYNC_INT_LEVEL_MASK       0x08u
#define MPU6050_INT_PIN_CFG_FSYNC_INT_LEVEL_GET(reg)   (((uint8_t)(reg) & 0x08u) >> 3u)
#define MPU6050_INT_PIN_CFG_FSYNC_INT_LEVEL_SET(reg, val) (((uint8_t)(reg) & (uint8_t)~0x08u) | (((uint8_t)(val) << 3u) & 0x08u))

Related parts

ADXL345
Analog Devices
30 registers
DS1307
Analog Devices
8 registers
DS3231
Analog Devices
19 registers

Source

Transcribed from InvenSense MPU-6000/MPU-6050 Register Map and Descriptions (hand-transcribed) (hand-transcribed). Hand-authored seed entry, not machine-extracted. Check against InvenSense MPU-6000/MPU-6050 Register Map and Descriptions before trusting it, then mark it verified.

Raw JSON · Report an error