All parts / BMP280
BMP280 register map
Digital pressure and temperature sensor — Bosch Sensortec
I²C address conflict. On its default address(es) this part collides with BME280 (0x76, 0x77); PCA9685 (0x76, 0x77). 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 BMP280 --out ./src --driver --tests
Writes bmp280_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
| Addr | Register | Access | Width | Reset | Description |
|---|---|---|---|---|---|
| 0xD0 | CHIP_ID | RO | 8 | 0x58 | Chip identification number. Reads 0x58 on a BMP280 (0x60 on a BME280). |
| 0xE0 | RESET | WO | 8 | 0x00 | Write 0xB6 to trigger a soft reset. Any other value is ignored. Reads return 0x00. |
| 0xF3 | STATUS | RO | 8 | 0x00 | Device status |
| 0xF4 | CTRL_MEAS | RW | 8 | 0x00 | Pressure and temperature acquisition options, and the sensor mode |
| 0xF5 | CONFIG | RW | 8 | 0x00 | Rate, filter and interface options. Writes are ignored in normal mode. |
| 0xF7 | PRESS_MSB | RO | 8 | 0x80 | Raw pressure, bits [19:12] |
| 0xF8 | PRESS_LSB | RO | 8 | 0x00 | Raw pressure, bits [11:4] |
| 0xF9 | PRESS_XLSB | RO | 8 | 0x00 | Raw pressure, bits [3:0] in bits [7:4] |
| 0xFA | TEMP_MSB | RO | 8 | 0x80 | Raw temperature, bits [19:12] |
| 0xFB | TEMP_LSB | RO | 8 | 0x00 | Raw temperature, bits [11:4] |
| 0xFC | TEMP_XLSB | RO | 8 | 0x00 | Raw temperature, bits [3:0] in bits [7:4] |
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.
STATUS @ 0xF3 — 2 fields
—7
—6
—5
—4
MEASURING[3]
—2
—1
IM_UPDATE[0]
| Bits | Field | Access | Mask | Reset | Description |
|---|---|---|---|---|---|
| [3] | MEASURING | RO | 0x08 | 0x00 | Set while a conversion is running |
| [0] | IM_UPDATE | RO | 0x01 | 0x00 | Set while NVM data is being copied to image registers |
CTRL_MEAS @ 0xF4 — 3 fields
OSRS_T[7:5]
OSRS_P[4:2]
MODE[1:0]
| Bits | Field | Access | Mask | Reset | Description |
|---|---|---|---|---|---|
| [7:5] | OSRS_T | RW | 0xE0 | 0x00 | Oversampling setting for temperature |
| [4:2] | OSRS_P | RW | 0x1C | 0x00 | Oversampling setting for pressure |
| [1:0] | MODE | RW | 0x03 | 0x00 | Sensor operating mode |
CTRL_MEAS.OSRS_T values
| Value | Name | Meaning |
|---|---|---|
| 0x00 | SKIPPED | Measurement skipped, output set to 0x80000 |
| 0x01 | X1 | Oversampling x1 |
| 0x02 | X2 | Oversampling x2 |
| 0x03 | X4 | Oversampling x4 |
| 0x04 | X8 | Oversampling x8 |
| 0x05 | X16 | Oversampling x16 |
CTRL_MEAS.OSRS_P values
| Value | Name | Meaning |
|---|---|---|
| 0x00 | SKIPPED | Measurement skipped, output set to 0x80000 |
| 0x01 | X1 | Oversampling x1 |
| 0x02 | X2 | Oversampling x2 |
| 0x03 | X4 | Oversampling x4 |
| 0x04 | X8 | Oversampling x8 |
| 0x05 | X16 | Oversampling x16 |
CTRL_MEAS.MODE values
| Value | Name | Meaning |
|---|---|---|
| 0x00 | SLEEP | No measurements, minimum power |
| 0x01 | FORCED | One measurement, then return to sleep |
| 0x02 | FORCED_ALT | Alternate encoding of forced mode |
| 0x03 | NORMAL | Cycles between measuring and standby |
CONFIG @ 0xF5 — 3 fields
T_SB[7:5]
FILTER[4:2]
—1
SPI3W_EN[0]
| Bits | Field | Access | Mask | Reset | Description |
|---|---|---|---|---|---|
| [7:5] | T_SB | RW | 0xE0 | 0x00 | Inactive duration in normal mode |
| [4:2] | FILTER | RW | 0x1C | 0x00 | IIR filter time constant |
| [0] | SPI3W_EN | RW | 0x01 | 0x00 | Enable 3-wire SPI interface |
CONFIG.T_SB values
| Value | Name | Meaning |
|---|---|---|
| 0x00 | 0_5_MS | 0.5 ms |
| 0x01 | 62_5_MS | 62.5 ms |
| 0x02 | 125_MS | 125 ms |
| 0x03 | 250_MS | 250 ms |
| 0x04 | 500_MS | 500 ms |
| 0x05 | 1000_MS | 1000 ms |
| 0x06 | 2000_MS | 2000 ms -- differs from the BME280 |
| 0x07 | 4000_MS | 4000 ms -- differs from the BME280 |
CONFIG.FILTER values
| Value | Name | Meaning |
|---|---|---|
| 0x00 | OFF | Filter off |
| 0x01 | COEFF_2 | Coefficient 2 |
| 0x02 | COEFF_4 | Coefficient 4 |
| 0x03 | COEFF_8 | Coefficient 8 |
| 0x04 | COEFF_16 | Coefficient 16 |
Generated C header
What regforge gen BMP280 writes for CTRL_MEAS:
/* ------------------------------------------------------------------------ */
/* CTRL_MEAS @ 0xF4u rw 8-bit reset 0x00u */
/* Pressure and temperature acquisition options, and the sensor mode */
/* ------------------------------------------------------------------------ */
#define BMP280_CTRL_MEAS 0xF4u
#define BMP280_CTRL_MEAS_WIDTH 8u
#define BMP280_CTRL_MEAS_RESET 0x00u
/* OSRS_T bits [7:5] rw reset 0x00u -- Oversampling setting for temperature */
#define BMP280_CTRL_MEAS_OSRS_T_SHIFT 5u
#define BMP280_CTRL_MEAS_OSRS_T_WIDTH 3u
#define BMP280_CTRL_MEAS_OSRS_T_MASK 0xE0u
#define BMP280_CTRL_MEAS_OSRS_T_GET(reg) (((uint8_t)(reg) & 0xE0u) >> 5u)
#define BMP280_CTRL_MEAS_OSRS_T_SET(reg, val) (((uint8_t)(reg) & (uint8_t)~0xE0u) | (((uint8_t)(val) << 5u) & 0xE0u))
#define BMP280_CTRL_MEAS_OSRS_T_SKIPPED 0x00u /* Measurement skipped, output set to 0x80000 */
#define BMP280_CTRL_MEAS_OSRS_T_X1 0x01u /* Oversampling x1 */
#define BMP280_CTRL_MEAS_OSRS_T_X2 0x02u /* Oversampling x2 */
#define BMP280_CTRL_MEAS_OSRS_T_X4 0x03u /* Oversampling x4 */
#define BMP280_CTRL_MEAS_OSRS_T_X8 0x04u /* Oversampling x8 */
#define BMP280_CTRL_MEAS_OSRS_T_X16 0x05u /* Oversampling x16 */
/* OSRS_P bits [4:2] rw reset 0x00u -- Oversampling setting for pressure */
#define BMP280_CTRL_MEAS_OSRS_P_SHIFT 2u
#define BMP280_CTRL_MEAS_OSRS_P_WIDTH 3u
#define BMP280_CTRL_MEAS_OSRS_P_MASK 0x1Cu
#define BMP280_CTRL_MEAS_OSRS_P_GET(reg) (((uint8_t)(reg) & 0x1Cu) >> 2u)
#define BMP280_CTRL_MEAS_OSRS_P_SET(reg, val) (((uint8_t)(reg) & (uint8_t)~0x1Cu) | (((uint8_t)(val) << 2u) & 0x1Cu))
#define BMP280_CTRL_MEAS_OSRS_P_SKIPPED 0x00u /* Measurement skipped, output set to 0x80000 */
#define BMP280_CTRL_MEAS_OSRS_P_X1 0x01u /* Oversampling x1 */
#define BMP280_CTRL_MEAS_OSRS_P_X2 0x02u /* Oversampling x2 */
#define BMP280_CTRL_MEAS_OSRS_P_X4 0x03u /* Oversampling x4 */
#define BMP280_CTRL_MEAS_OSRS_P_X8 0x04u /* Oversampling x8 */
#define BMP280_CTRL_MEAS_OSRS_P_X16 0x05u /* Oversampling x16 */
/* MODE bits [1:0] rw reset 0x00u -- Sensor operating mode */
#define BMP280_CTRL_MEAS_MODE_SHIFT 0u
#define BMP280_CTRL_MEAS_MODE_WIDTH 2u
#define BMP280_CTRL_MEAS_MODE_MASK 0x03u
#define BMP280_CTRL_MEAS_MODE_GET(reg) (((uint8_t)(reg) & 0x03u) >> 0u)
#define BMP280_CTRL_MEAS_MODE_SET(reg, val) (((uint8_t)(reg) & (uint8_t)~0x03u) | (((uint8_t)(val) << 0u) & 0x03u))
#define BMP280_CTRL_MEAS_MODE_SLEEP 0x00u /* No measurements, minimum power */
#define BMP280_CTRL_MEAS_MODE_FORCED 0x01u /* One measurement, then return to sleep */
#define BMP280_CTRL_MEAS_MODE_FORCED_ALT 0x02u /* Alternate encoding of forced mode */
Compared with
Related parts
Source
Transcribed from BST-BMP280-DS001 (hand-transcribed) (hand-transcribed). Hand-authored seed entry, not machine-extracted. Check against BST-BMP280-DS001 before trusting it, then mark it verified.