Skip to content

Figures

Every figure on this site is drawn by a Python module from facts extracted from the code, so it is rebuilt, not redrawn, when the code changes. CI runs kokeb-docs figures --check and fails when a committed figure no longer matches the code. Each figure below lists the files it is drawn from.

Inside the BMP581

Block diagram of the BMP581: its function blocks, how they connect and which package pins reach each block.Block diagram of the BMP581: its function blocks, how they connect and which package pins reach each block.
Inside the BMP581
Figure description and sources

The BMP581's function blocks inside its outline. Arrows between blocks carry signals or data in the direction they point (both ways where they have two heads). The package pins stand on the left and right edges with their numbers, each wired to the block it reaches.

Drawn from: docs/hardware.yml; inc/bmp581_i2c_interface.hpp; inc/bmp581_spi_interface.hpp.

Hardware description: docs/hardware.yml

Drawn from:

BMP581: I2C connection

Schematic of the BMP581 i2c connection: the chip with U2 MCU, R1 resistor 4.7 kΩ, R2 resistor 4.7 kΩ, C1 capacitor 100 nF, C2 capacitor 100 nF; the MCU wires carry the port hooks Transfer(), WriteRead() or Transfer().Schematic of the BMP581 i2c connection: the chip with U2 MCU, R1 resistor 4.7 kΩ, R2 resistor 4.7 kΩ, C1 capacitor 100 nF, C2 capacitor 100 nF; the MCU wires carry the port hooks Transfer(), WriteRead() or Transfer().
BMP581: I2C connection
Figure description and sources

A schematic. The MCU is on the left, each of its pins level with the chip pin it connects to; above each wire is the hook of the driver's port that drives or reads it. Supply pins point up to their supply and decoupling, ground pins down. Pins on the right carry the loads and the pins tied to a supply or ground; a cross marks a pin left open. A dot is a junction; wires that cross without a dot are not connected.

Drawn from: docs/hardware.yml; inc/bmp581_i2c_interface.hpp; inc/bmp581_spi_interface.hpp.

Hardware description: docs/hardware.yml

Drawn from:

BMP581: SPI 4-wire connection

Schematic of the BMP581 spi 4-wire connection: the chip with U2 MCU, R1 resistor 47 kΩ, C1 capacitor 100 nF, C2 capacitor 100 nF; the MCU wires carry the port hooks Transfer(), WriteRead() or Transfer().Schematic of the BMP581 spi 4-wire connection: the chip with U2 MCU, R1 resistor 47 kΩ, C1 capacitor 100 nF, C2 capacitor 100 nF; the MCU wires carry the port hooks Transfer(), WriteRead() or Transfer().
BMP581: SPI 4-wire connection
Figure description and sources

A schematic. The MCU is on the left, each of its pins level with the chip pin it connects to; above each wire is the hook of the driver's port that drives or reads it. Supply pins point up to their supply and decoupling, ground pins down. Pins on the right carry the loads and the pins tied to a supply or ground; a cross marks a pin left open. A dot is a junction; wires that cross without a dot are not connected.

Drawn from: docs/hardware.yml; inc/bmp581_i2c_interface.hpp; inc/bmp581_spi_interface.hpp.

Hardware description: docs/hardware.yml

Drawn from:

BMP581 pinout, LGA-10

Pinout of the BMP581 in LGA-10, top view: 10 pins, each with its name, its electrical type as a colour and the driver hook that uses it.Pinout of the BMP581 in LGA-10, top view: 10 pins, each with its name, its electrical type as a colour and the driver hook that uses it.
BMP581 pinout, LGA-10
Figure description and sources

The BMP581 seen from the top, in its LGA-10 package. Pin 1 is marked by the dot; the numbers run counter-clockwise from it. Each pad is coloured by the pin's electrical type (legend below). Next to it is the pin's name and, in mono, the hook of the driver's port that drives or reads it; a pin without a hook is not used by the driver.

Drawn from: docs/hardware.yml; inc/bmp581_i2c_interface.hpp; inc/bmp581_spi_interface.hpp.

Hardware description: docs/hardware.yml

Drawn from:

The layers, one of them yours

Layer diagram: your application calls the BMP581 core, which sends register reads and writes through the I2C or SPI port contract to the port class you write, which drives the chip; the core and the contract are the same on every MCU.Layer diagram: your application calls the BMP581 core, which sends register reads and writes through the I2C or SPI port contract to the port class you write, which drives the chip; the core and the contract are the same on every MCU.
The layers, one of them yours
Figure description and sources

Top to bottom, each arrow is a call. Your application calls one object, whose public calls are listed from the umbrella header in inc/. The core turns each call into register reads and writes and hands them to the port contract (the CRTP base in inc/*_interface.hpp), which forwards them, at compile time, to the hooks of the port class you write; your port moves the bytes on the bus. The notes on the right say which layers stay the same on every MCU and which one you write. A library without a port contract has only the first two layers.

Drawn from: inc/bmp581.hpp public calls; inc/bmp581_i2c_interface.hpp I2cInterface; inc/bmp581_spi_interface.hpp SpiInterface; figure module docs/diagrams/figures/driver-layers.py.

Figure module: docs/diagrams/figures/driver-layers.py

Drawn from:

From a conversion to a value

Flow chart: MeasureOnce() or WaitDataReady() leads to one 12-byte read of TEMP_DATA to STATUS, then the checks: reserved registers and stuck lines, the reset flag, the reset value, the measurement range; each failing check returns its error, and only a frame that passes them all is a value.Flow chart: MeasureOnce() or WaitDataReady() leads to one 12-byte read of TEMP_DATA to STATUS, then the checks: reserved registers and stuck lines, the reset flag, the reset value, the measurement range; each failing check returns its error, and only a frame that passes them all is a value.
From a conversion to a value
Figure description and sources

Two entry points at the top. MeasureOnce() runs the reset check (INT_STATUS, then OSR_CONFIG to OSR_EFF in one read), writes ODR_CONFIG with pwr_mode = forced, polls it until it shows forced (at most t_startup) to prove the measurement started, waits the typical conversion time less 5 percent, then polls the same registers until the chip is back in standby, at most the datasheet maximum. In normal or continuous mode, WaitDataReady() polls INT_STATUS until drdy. Both end in the same read: one 12-byte burst of TEMP_DATA to STATUS, so temperature and pressure come from one conversion (data shadowing). The checks below run in order, and each failure has its error card on the right: the reserved registers must read 0x00 and the frame must not be all 0x00 (a stuck or floating line); INT_STATUS goes to the latch, and a por in it runs the reset check; the reset value 0x7F7F7F is no measurement and runs the reset check too; the values must lie in the measurement range. Only then is the value returned, in 1/64 Pa and 1/65536 degrees Celsius.

Drawn from: src/bmp581.ipp MeasureOnce, waitForcedShown, WaitDataReady, readData, settle; inc/bmp581_registers.hpp kDataReset; inc/bmp581_types.hpp kPressureMinPa, kPressureMaxPa, kTemperatureMinC, kTemperatureMaxC; figure module docs/diagrams/figures/measurement.py.

Figure module: docs/diagrams/figures/measurement.py

Drawn from:

What EnsureInitialized() does

Flow chart of EnsureInitialized(): check the configuration and the address, wait the power-up time, soft reset, check CHIP_ID, NVM ready and the reset flag, write and read back the configuration, enter the power mode; each failing step returns its error.Flow chart of EnsureInitialized(): check the configuration and the address, wait the power-up time, soft reset, check CHIP_ID, NVM ready and the reset flag, write and read back the configuration, enter the power mode; each failing step returns its error.
What EnsureInitialized() does
Figure description and sources

Top to bottom on the left, the steps of the first EnsureInitialized() call; once it has succeeded a later call runs the reset check (one 3-byte read of OSR_CONFIG to OSR_EFF) and returns Ok, or starts again at the top when the chip reset. The configuration and the I2C address are checked before any I/O. Step 1 waits the power-up time and, on SPI, sends the dummy read that changes the chip from I2C to SPI. Step 2 is the soft reset: standby with deep standby off first (the datasheet does not say that deep standby takes CMD), then CMD = 0xB6, which the chip does not acknowledge over I2C, then the soft reset time, and on SPI the selection read again, since a reset returns the interface to I2C. Step 3 is the datasheet's post-power-up check: CHIP_ID, STATUS polled until the NVM is ready with no error, and INT_STATUS, which must read 0x10 (the reset happened) and then 0x00 (the read cleared it), a check no stuck, floating or looped-back line can pass. Step 4 leaves the deep standby the reset left the chip in (standby with deep standby off, then t_standby), writes the marker to NVM_DATA once, writes the configuration one register per transfer with ODR_CONFIG last, reads all of it and the marker back, reads INT_STATUS once more, and enters the configured power mode, read back too. Each card on the right is the error a step returns; after any failure the driver stays uninitialised and the next call starts at the top.

Drawn from: src/bmp581.ipp EnsureInitialized, initialize, resetChip, identify, waitNvmReady, checkResetFlags, configure; inc/bmp581_registers.hpp kChipIdValue, kIntStatusAfterReset, kCmdSoftReset; inc/bmp581_types.hpp kPowerUpUs, kSoftResetUs; figure module docs/diagrams/figures/start-up.py.

Figure module: docs/diagrams/figures/start-up.py

Drawn from: