SFM Flow Meter Driver 1.0.0
API reference
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
sfm_commands.hpp File Reference

I2C command codes, addresses, timing and CRC-8 for Sensirion flow meters: the SF06 family (SFM4300 data sheet §4) and the SFx6000 family (SFC6xxx / SFM6xxx I2C interface reference v1.1). More...

#include <cstddef>
#include <cstdint>
Include dependency graph for sfm_commands.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  sfm
 
namespace  sfm::addr
 7-bit I2C addresses (data sheet §4.1 / ADDR pin strapping on SFM4300).
 
namespace  sfm::cmd
 16-bit command codes (data sheet §4.3, Tables 3–12).
 
namespace  sfm::timing
 Timing (data sheet §2.4 / §4.3).
 

Functions

constexpr uint8_t sfm::Crc8 (const uint8_t *data, std::size_t len) noexcept
 CRC-8 per Sensirion SF06 (poly 0x31, init 0xFF, no reflection/xorout).
 
constexpr uint8_t sfm::Crc8Word (uint16_t word) noexcept
 CRC-8 of one big-endian 16-bit word.
 

Variables

constexpr uint8_t sfm::addr::kSfm4300Default = 0x2A
 ADDR to GND or floating.
 
constexpr uint8_t sfm::addr::kSfm4300Alt1 = 0x2B
 ADDR to GND via 1.2 kΩ
 
constexpr uint8_t sfm::addr::kSfm4300Alt2 = 0x2C
 ADDR to GND via 2.7 kΩ
 
constexpr uint8_t sfm::addr::kSfm4300Alt3 = 0x2D
 ADDR to GND via 5.6 kΩ
 
constexpr uint8_t sfm::addr::kSfm3119 = 0x29
 
constexpr uint8_t sfm::addr::kSfm3003 = 0x28
 SFM3003-300-CL.
 
constexpr uint8_t sfm::addr::kSfm3003Ce = 0x2D
 SFM3003-300-CE (SFM3003 data sheet Table 2)
 
constexpr uint8_t sfm::addr::kSfm3013 = 0x2F
 
constexpr uint8_t sfm::addr::kSfm3019 = 0x2E
 
constexpr uint8_t sfm::addr::kSfm6000Default = 0x24
 SFx6000 (SFM6000D / SFC6000D): ADDR pin to GND through a resistor (±5 %).
 
constexpr uint8_t sfm::addr::kSfm6000R560 = 0x23
 560 Ω
 
constexpr uint8_t sfm::addr::kSfm6000R1k2 = 0x22
 1.2 kΩ
 
constexpr uint8_t sfm::addr::kSfm6000R2k7 = 0x21
 2.7 kΩ
 
constexpr uint8_t sfm::addr::kSfm6000R5k6 = 0x20
 5.6 kΩ
 
constexpr uint8_t sfm::addr::kSfm6000R12k = 0x42
 12 kΩ
 
constexpr uint8_t sfm::addr::kSfm6000R27k = 0x41
 27 kΩ
 
constexpr uint8_t sfm::addr::kGeneralCall = 0x00
 I2C general-call (soft reset)
 
constexpr uint16_t sfm::cmd::kStartO2 = 0x3603
 
constexpr uint16_t sfm::cmd::kStartAir = 0x3608
 
constexpr uint16_t sfm::cmd::kStartN2O = 0x3615
 
constexpr uint16_t sfm::cmd::kStartCO2 = 0x361E
 
constexpr uint16_t sfm::cmd::kStartAirO2Mix = 0x3632
 argument: O2 volume fraction (‰)
 
constexpr uint16_t sfm::cmd::kStartN2OO2Mix = 0x3639
 argument: O2 volume fraction (‰)
 
constexpr uint16_t sfm::cmd::kStartCO2O2Mix = 0x3646
 argument: O2 volume fraction (‰)
 
constexpr uint16_t sfm::cmd::kSfx6000StartGas0 = 0x3603
 O2.
 
constexpr uint16_t sfm::cmd::kSfx6000StartGas1 = 0x3608
 Air.
 
constexpr uint16_t sfm::cmd::kSfx6000StartGas2 = 0x3615
 CO2 (N2O on SF06!)
 
constexpr uint16_t sfm::cmd::kSfx6000StartGas3 = 0x361E
 N2O (CO2 on SF06!)
 
constexpr uint16_t sfm::cmd::kSfx6000StartGas4 = 0x3624
 Ar.
 
constexpr uint16_t sfm::cmd::kSfx6000StartMix0 = 0x3650
 Gas0 in Gas1 (O2 in Air); argument ‰
 
constexpr uint16_t sfm::cmd::kSfx6000PointerGasInfo = 0xE151
 after kReadScaleOffsetUnit
 
constexpr uint16_t sfm::cmd::kSfx6000PointerTemperature = 0xE102
 while measuring (product ID when idle)
 
constexpr uint16_t sfm::cmd::kSfx6000PointerResult = 0xE000
 back to flow / reserved / status
 
constexpr uint16_t sfm::cmd::kUpdateConcentrationSet = 0xE17D
 argument: ‰
 
constexpr uint16_t sfm::cmd::kUpdateConcentrationActivate = 0xE000
 
constexpr uint16_t sfm::cmd::kStopContinuous = 0x3FF9
 
constexpr uint16_t sfm::cmd::kConfigureAveraging = 0x366A
 argument: N (0 = avg-until-read)
 
constexpr uint16_t sfm::cmd::kReadScaleOffsetUnit = 0x3661
 argument: start command code
 
constexpr uint16_t sfm::cmd::kEnterSleep = 0x3677
 
constexpr uint16_t sfm::cmd::kReadProductIdentifier = 0xE102
 
constexpr uint8_t sfm::cmd::kGeneralCallReset = 0x06
 single byte to address 0x00
 
constexpr uint32_t sfm::timing::kFirstResultAfterStartMs = 12
 first reading valid after start
 
constexpr uint32_t sfm::timing::kAccuracySettleAfterStartMs = 30
 few-% deviations possible before
 
constexpr uint32_t sfm::timing::kSoftResetMs = 20
 typ. 16 ms, max 20 ms
 
constexpr uint32_t sfm::timing::kWarmUpMs = 30
 after reset / exit sleep
 
constexpr uint32_t sfm::timing::kMeasurementPeriodUs = 500
 internal sample period (~2 kHz)
 
constexpr uint32_t sfm::timing::kStopToIdleUs = 500
 §4.3.4: idle and receptive ≤ 0.5 ms after stop
 
constexpr uint32_t sfm::timing::kStopToIdleMs = 1
 kStopToIdleUs rounded up for DelayMs()
 
constexpr uint16_t sfm::timing::kMaxAveragingWindow = 128
 
constexpr uint32_t sfm::timing::kSfx6000SoftResetMs = 30
 interface reference §1.2
 
constexpr uint32_t sfm::timing::kSfx6000MeasurementPeriodUs = 1000
 1 kHz, NACK when no new sample
 
constexpr uint16_t sfm::kFlowUnitSlm20C = 0x0148
 Fixed flow-unit code returned by the SFM4300 (slm at 20 °C, 1013.25 mbar).
 
constexpr float sfm::kTemperatureScalePerC = 200.0f
 Temperature scale (data sheet Tables 15/16: scale 200 per °C, offset 0).
 
constexpr uint16_t sfm::kStatusPureGasFraction = 0x3FF
 Status-word gas fraction value for a pure calibration gas (bits 9:0).
 

Detailed Description

I2C command codes, addresses, timing and CRC-8 for Sensirion flow meters: the SF06 family (SFM4300 data sheet §4) and the SFx6000 family (SFC6xxx / SFM6xxx I2C interface reference v1.1).

Framing (16-bit commands, word + CRC-8 reads) is shared by both families. Gas meaning of the start codes is not: 0x3615 is N2O on SF06 and CO2 on SFx6000, 0x361E the reverse. Never use these constants directly to pick a gas — go through StartCommandFor(Family, Gas) in sfm_types.hpp. Checksum is CRC-8, polynomial 0x31, init 0xFF, no reflection, no final XOR; test vector 0xBE 0xEF → 0x92.