Sensirion I2c Functional Description sfm3xxx
Sensirion I2c Functional Description sfm3xxx
Key content
▪ I2C communication details
▪ Command set and data transfer sequences
▪ Reset, limitations and extended command sets
Summary
This document describes the I2C communication with the SFM3xxx sensor series. Communication between the
master and the SFM3xxx series sensor runs via the digital I2C-interface. This document contains all essential as
well as several extended commands and some basic descriptions of the SFM3xxx series I2C protocol. For the
detailed specifications please check the NXP document "The I2C-Bus Specification".
1 Interface connection
Bi-directional bus lines are implemented by the devices (master and slave) using open-drain output stages and a
pull-up resistor (Rp) connected to the positive supply voltage.
The recommended pull-up resistor value depends on the system setup, particularly on the capacitance of the
circuit or cable and bus clock frequency. For quick prototyping a value of 10kOhm is a reasonable choice. Please
refer to NXP’s I2C bus specification in order to determine the optimal value.
The capacitive loads on SDA and SCL line have to be the same. It is important to avoid asymmetric capacitive
loads. In case of long wires (>10cm) it is necessary to shield SDA and SCL. Wires longer than 30cm should not
be used.
VDD
m a ste r Rp Rp sla ve (S F M 3 0 0 0)
SDA
SCL
Both bus lines, SDA and SCL, are bi-directional and require an external pull-up resistor.
2 I2C Address
The I2C address is represented by a 7-digit binary value. By default, the I2C address is set to 64 (1000000b). The
address is always followed by a write bit (0) or read bit (1). The default hexadecimal I2C header for read access
to the sensor is therefore 0x81.
The START condition is a unique situation on the bus created by the master, indicating to the slaves the
beginning of a transmission sequence (the bus is considered busy after a START).
SDA
SCL
S
START condition
The STOP condition is a unique situation on the bus created by the master, indicating to the slaves the end of a
transmission sequence (the bus is considered free after a STOP).
SDA
SCL
P
STOP condition
Each byte transmitted over the I2C bus is followed by an acknowledge condition from the receiver. This means
that after the master pulls SCL low to complete the transmission of the 8th bit, SDA will be pulled low by the
receiver during the 9th bit time. If after transmission of the 8th bit the receiver does not pull the SDA line low, this
is considered to be a NACK condition.
n o t a ckn o w le d g e
SDA
a ckn o w le d g e
Data is transferred in byte packets in the I2C protocol. Each byte is followed by an acknowledge bit. Data is
transferred with the most significant bit first.
A data transfer sequence is initiated by the master generating the Start condition (S) and sending a header byte.
The I2C header consists of the 7-bit I2C device address and the data direction bit (R/_W).
The value of the R/_W bit in the header determines the data direction for the rest of the data transfer sequence. If
R/_W = 0 (WRITE) the direction remains master-to-slave, while if R/_W = 1 (READ) the direction changes to
slave-to-master after the header byte.
If a correctly addressed sensor recognizes a valid command and access to this command is granted, it responds
by pulling down the SDA line during the subsequent SCL pulse for the acknowledge signal (ACK). Otherwise it
leaves the SDA line unasserted (NACK).
The commands are described below, and the data transfer sequences are specified.
ACK
ACK
S W
I2C master reads command results from SFM3000 with address I2CAdr
NACK
ACK
ACK
S R P
or
ACK
ACK
ACK
S R
NACK
ACK
Dark areas with white text indicate that the sensor controls the SDA (Data) line.
Flow measurements are started by writing the start measurement command (0x1000) to the sensor.
Measurement results are continuously updated until the measurement mode is stopped by sending any other
command or by a sensor reset. After a start measurement command, the measurement results can be read out
The tables below give an example sequence with explanations for every command.
1This means that an I2C header with R/_W bit = 1 could be sent continuously to read out those results, without preceding it
with command 0x1000
Data that is read back from the Sensor consists of two or four bytes, with the most significant byte and bit read
first. The least significant bit and byte are read last. The following maps give more details on the content of the
different results:
In order to obtain the measured flow in the predefined unit, the flow measurement result needs to be converted
according to the following formula:
The SFM3000 sensor implements the CRC-8 standard based on the generator polynomial: x8 + x5 + x4 +1. (0x31)
Note that CRC is only used for data transmitted from the slave to the master.
For details regarding cyclic redundancy checking, please refer to the AppNote SFM-04 “CRC Checksum” on our
website and the relevant literature.
6 Soft reset
The soft reset command forces a sensor reset without switching the power off and on again. On receipt of this
command, the sensor reinitializes the control/status register contents from the non-volatile memory and starts
operating according to these settings.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
ACK
ACK
ACK
S 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 system reboot
W Command[7:0]
I2CAdr Command[15:8]
7 Limitations
The I2C interface of the SFM3xxxx show deviations from the NXP I2C specification and might lock up and cease
to react (including to the soft reset command), under the following conditions:
▪ Glitches on the SCL, for example caused by electromagnetic irradiation or coupling.
▪ The master does not acknowledge the first byte read from the sensor after having sent the header byte (I2C
address + R bit). The critical acknowledge bit is highlighted below.
NACK
I2CAdr[6:0] Data[15:8] Data[7:0] CRC[7:0]
ACK
ACK
ACK
S R P
Dark areas with white text indicate that the sensor controls the SDA (Data) line.
The following design precautions are recommended to reduce the probability of sensor freeze/lockup and to
restore the sensor operation with a power (hard) reset in the event of a freeze:
▪ The cable length from the sensor to the microprocessor is recommended to be as short as possible and not
longer than 30 cm as well as shielded. For wires longer than 10 cm the SDA and SCL must be shielded.
Sources that emit electromagnetic radiation must be kept away from the I2C connection.
▪ When data is read from the sensor, one must ensure that the first data byte of the transaction is always
acknowledged by the master.
▪ It must be possible to reset the sensor through a hard reset in case the sensor freezes by powering the
supply voltage of the sensor off and on again.
Suggested measures and error handling logic to establish a reliable communication and read-out of the
measurement values:
▪ Send the “Start measurement” command before every read command to avoid an unnoticed sensor reset.
▪ Ensure the sensor acknowledges all commands, and the CRC checksum of the measurement data is valid.
▪ In case of an unexpected behavior from the sensor (NACK or a wrong CRC checksum), use the last valid
flow value and perform a sensor power (hard) reset if the error persists for 5 (or any other application
specific error threshold) consecutive cycles.
Command # of bytes to
Task Detailled Command Description
[16 bit] read back
Start flow
0x1000 2 Start continuous flow measurement
measurement
Start temperature Start continuous temperature measurement. Bit <1:0>
0x1001 2
measurement* are always zero.
Read scale factor 0x30DE 2 Combining both bytes yields the flow scale factor
Read offset 0x30DF 2 Combining both bytes yields the flow offset
In order to read out the product type/article number,
0x31E3 2 two commands have to be sent to the sensor resulting
Read article in 4 bytes of data (bits <31:0>). The command 0x31E3
number results in the first two bytes (bits <31:16>) followed by
0x31E4 2 command 0x31E4 with another two bytes (bits
<15:0>).
In order to read out the serial number, two commands
0x31AE 2 have to be sent to the sensor resulting in 4 bytes of
Read serial number data (bits <31:0>). The command 0x31AE results in
the first two bytes (bits <31:16>) followed by command
0x31AF 2
0x31AF with another two bytes (bits <15:0>).
Soft reset 0x2000 NA Soft reset command
SFM3xxx-AW versions only! There is an additional EEPROM on the SFM3300-AW and SFM3400-AW to allow
storage of customer-specific data (e.g. usage hours). Please see all details in the datasheet of the EEPROM. The
EEPROM is of type 24LC01BT-I/MC. No additional validation or modification of EEPROM settings has been
performed by Sensirion.
*Allows read out of the chip temperature. Please note that the sensor temperature does not necessarily reflect the
temperature of the gas flowing through the sensor. See additional AppNote SFM-08 “Temperature Effects”.