background image

Chapter 2 _______________________________________________________________ I2C Interface 

VAISALA  _____________________________________________________________________ 5 

Communication Flow 

Basic communication flow always includes I

2

C write and read 

commands. First the master writes a command to the slave device, and 

then the master reads the results of that command from the slave. 

When the master reads data from the slave, there is an ACK/NACK-bit in 

the status byte that informs the master whether or not communication 

was success. ACK is defined as zero and NACK is defined as one in the 

logical level. 

NOTE 

This ACK/NACK refers to message level acknowledge. I

2

C protocol 

includes separate byte level acknowledge. 

Command messages sent by the master are called 

invokes

. Replies sent 

by the slave are called 

responses

. Note that also responses include the 

device address. 

Table 6 

Invoke Message in HMM105 I

2

C Interface 

Message Segment  Length 

Content 

Start 

 

I

2

C start condition. 

I

2

C address 

1 byte 

See Table 4 on page 4. 

Command 

1 byte 

Identifier of command. 

Device address 

1 byte 

See Table 5 on page 4. 

Frame length 

1 byte 

Length of invoke message in bytes 

(excluding I

2

C address, including CRC). 

Minimum invoke frame length is 5 bytes. 

Data 

Variable length  Content and length depending on the 

command. May be left out if command 

contains no data in the invoke message. 

Checksum 

2 bytes 

See section Checksum on page 9. 

Stop 

 

I

2

C stop condition  

 

Table 7 

Response Message in HMM105 I

2

C Interface 

Message Segment  Length 

Content 

Start 

 

I

2

C start condition. 

I

2

C address 

1 byte 

See Table 4 on page 4. 

Status 

1 byte 

See section Status Byte on page 9. 

Command 

1 byte 

Identifier of the command that was used 

in the invoke that the slave is 

responding to. If slave is in idle state (no 

valid invoke), command code is FFh. 

Device address 

1 byte 

See Table 5 on page 4. 

Frame length 

1 byte 

Length of the response message in 

bytes (excluding I

2

C address, including 

CRC). The minimum response frame 

length is 6 bytes.

 

Data 

Variable length  Content and length depending on the 

command. 

Checksum 

2 bytes 

See section Checksum on page 9. 

Stop 

 

I

2

C stop condition  

Summary of Contents for HUMICAP HMM105

Page 1: ...TECHNICAL REFERENCE I2C Protocol Implementation HMM105 Humidity Module M211638EN C ...

Page 2: ...based on the original English versions In ambiguous cases the English versions are applicable not the translations The contents of this document are subject to change without prior notice Local rules and regulations may vary and they shall take precedence over the information contained in this document Vaisala makes no representations on this document s compliance with the local rules and regulati...

Page 3: ... Overview 3 Physical Interface 3 Communication Parameters 4 Addressing 4 Communication Flow 5 HMM105 State Machine 6 Examples of Communication Flow 7 Timing 9 Status Byte 9 Checksum 9 Status Word 10 Commands 11 Get_Interface_Version 11 Get_Parameter 12 Example Read RH Measurement Result 13 Set_Parameter 14 Example Set Compensation Pressure 15 Get_Parameter_Info 16 Adjust 17 Adjusting Measurement 1...

Page 4: ...rface implementation of the Vaisala HUMICAP Digital Humidity Module HMM105 Version Information Table 1 Document Versions Document Code Description M211638EN C November 2019 Updated Table 16 Table 21 and Table 32 M211638EN B December 2015 Updated description of checksum calculation M211638EN A May 2014 First version Related Manuals Table 2 Related Manuals Document Code Name M211637EN Vaisala HUMICA...

Page 5: ...ustments Physical Interface The physical interface is a non isolated 3 wire interface Wires are SDA SCL and ground SDA and SCL lines are buffered Ground is shared with power supply There are small pull up resistors for SCL and SDA Maximum cable length should not exceed 5 m and maximum capacitance between communication lines and ground should not exceed 500 pF 1405 072 Figure 1 Hardware Schematic T...

Page 6: ...101111 2Fh In I2 C communication the address should be provided by the master in the standard way after the I2 C start condition with the read write bit as the least significant bit LSB Table 4 HMM105 I2C Address 0 1 0 1 1 1 1 R W Device type Sub address Read write bit LSB The I2 C implementation of the HMM105 also includes the address inside the message frame The purpose of this is to make the I2...

Page 7: ...2C start condition I2C address 1 byte See Table 4 on page 4 Command 1 byte Identifier of command Device address 1 byte See Table 5 on page 4 Frame length 1 byte Length of invoke message in bytes excluding I2C address including CRC Minimum invoke frame length is 5 bytes Data Variable length Content and length depending on the command May be left out if command contains no data in the invoke message...

Page 8: ...tate and the master sends a new invoke the old response belonging to the old invoke will be lost When the master sends the next I2 C read command the HMM105 sends it the response to the latest invoke If HMM105 is in Idle state and I2 C read is sent HMM105 responds with a NACK signal This tells the master that the data which the master may have received in same I2 C read is not valid If the HMM105 ...

Page 9: ...re 3 below shows the following message sequence 1 The master invokes the Get_Parameter command to read the RH parameter using an I2 C write operation This command prepares the slave to wait for a read operation from the master 2 The master begins an I2 C read operation to read the results of the Get_Parameter RH command The slave sends the requested RH result and an ACK signal to the master 1401 0...

Page 10: ... 5 Get_Parameter with NACK 1401 021 Figure 6 Get_Parameter with Alarm NOTE Alarm can be any of the state bits in status byte Master Slave Get_Parameter RH_ID I2C Write Get_Parameter RH_ID nan NACK I2C Read Master Slave Get_Parameter RH_ID I2C Write Get_Parameter RH_ID 66 55 Alarm bit 1 ACK I2C Read Get_Parameter Status_ID I2C Write Get_Parameter Status_ID statusword ACK I2C Read ...

Page 11: ...atus Warning Error and Critical error statuses These bits are cleared when the status word is read Bits are set when the corresponding status or error state changes in the slave device Table 9 Status Byte Bit Description 0 ACK NACK 1 Critical error 2 Error 3 Warning 4 Status 5 6 7 Checksum HMM105 uses a CRC16 CCITT checksum in its protocol frame CCITT x 25 polynomial is X16 X12 X5 1 11021h Initial...

Page 12: ...status Changes in status word bits can be monitored by reading the status byte See section Status Byte on page 9 Table 10 Status Word Content Bit Type Purpose 0 Critical Error 1 Critical Error Parameter memory corrupted 2 Critical Error Parameter read failed 3 Critical Error Parameter write failed 4 Error 5 Error RH measurement error 6 Error T measurement error 7 Error 8 Error 9 Error 10 Error 11 ...

Page 13: ...ngth Content I2C address 1 byte I2C address write Command ID 1 byte Always 80h Device address 1 byte See Table 5 on page 4 Frame length 1 byte Always 05h Checksum 2 bytes See section Checksum on page 9 Table 12 Get_Interface_Version Response Message Message Segment Length Content I2C address 1 byte I2C address read Status 1 byte See section Status Byte on page 9 Command ID 1 byte Always 80h Device...

Page 14: ... byte Always 81h Device address 1 byte See Table 5 on page 4 Frame length 1 byte Always 06h Data 1 byte ID of parameter to be read Checksum 2 bytes See section Checksum on page 9 Table 14 Get_Parameter Response Message Message Segment Length Content I2C address 1 byte I2C address read Status 1 byte See section Status Byte on page 9 If requested parameter ID was unknown NACK bit is set in the statu...

Page 15: ...eter Invoke Message Example Message Bytes hex Content 2F I2C address 81 Get_Parameter command 2F Device address 06 Frame length 4F RH Parameter ID 6A CRC high D4 CRC lo Table 16 Get_Parameter Response Message Example Message Bytes hex Content 2F I2C address 00 Status byte no errors ACK 81 Get_Parameter command 2F Device address 0B Frame length 4F RH Parameter ID D4 RH value 14 43086624 RH E4 66 41...

Page 16: ...meter Invoke Message Message Segment Length Content I2C address 1 byte I2C address write Command ID 1 byte Always 82h Device address 1 byte See Table 5 on page 4 Frame length 1 byte Varies according to data length 07h 38h Data 1 byte Parameter ID 1 50 bytes Parameter value Checksum 2 bytes See section Checksum on page 9 Table 18 Set_Parameter Response Message Message Segment Length Content I2C add...

Page 17: ...ssage Bytes hex Content 2F I2C address 82 Set_Parameter command 2F Device address 0A Frame length 40 Parameter ID of compensation pressure 00 Pressure 1000 hpa 00 7A 44 D8 CRC high 31 CRC lo Table 21 Example Set_Parameter Response Message Message Bytes hex Content 2F I2C address 00 Status byte error active ACK 82 Set_parameter command 2F Device address 08 Frame length 40 Parameter ID of compensati...

Page 18: ...ecksum 2 bytes See section Checksum on page 9 Table 23 Get_Parameter_Info Response Message Message Segment Length Content I2C address 1 byte I2C address read Status 1 byte See section Status Byte on page 9 Command ID 1 byte Always 83h Device address 1 byte See Table 5 on page 4 Frame length 1 byte Always 12h Data 1 byte Parameter ID 1 byte Parameter datatype See Table 24 below 1 byte Parameter len...

Page 19: ... page 9 Table 27 Adjust Response Message Message Segment Length Content I2C address 1 byte I2C address read Status 1 byte See section Status Byte on page 9 Command ID 1 byte Always 84h Device address 1 byte See Table 5 on page 4 Frame length 1 byte Always 07h Data 1 byte Return code See Table 30 on page 18 Checksum 2 bytes See section Checksum on page 9 Table 28 Adjustment Subcommands Code Adjustm...

Page 20: ...ure T you must perform the following sequence 1 Using the Adjust command start 1 point adjustment for the chosen parameter 2 Place the sensor in the reference environment and wait until the measurement has stabilized 3 Using the Adjust command record the measured point and give the reference value 4 Use the Adjust command to end the adjustment Two Point Adjustment To perform a two point adjustment...

Page 21: ... as it has a maximum lifetime of approximately 30000 cycles Data Formats Table 31 Data Formats Data type name Size Bytes Other Byte 1 Value range 0 255 Integer 2 Value range 32768 32767 Unsigned integer 2 Value range 0 65535 Long integer 4 Value range 2 147 483 648 2 147 483 647 Unsigned long integer 4 Value range 0 4 294 967 295 Float 4 According to IEEE 754 NaN 7FC00000 is returned if no value i...

Page 22: ... R Yes Example J413 RH result RH 79 4 Float R No RH Temperature result T 65 4 Float R No Degrees of Celsius Fahrenheit see UNITS Dew Frost point Tdf TDF 88 4 Float R No Degrees of Celsius Fahrenheit see UNITS Ambient pressure in hPa P_AMB 64 4 Float R W Yes Ambient pressure in hPa Used for RH result RH Gain RH_G 96 4 Float R W Yes RH gain RH Offset RH_O 97 4 Float R W Yes RH offset Temperature Gai...

Page 23: ...www vaisala com M211638EN ...

Reviews: