IDT ZMOD44, ZMOD4410 Programming Manual

ZMOD44xx Programming Manual with ZMOD4410 Example
© 2018 Integrated Device Technology, Inc. 1 June 11, 2018
Contents
1. Introduction ...................................................................................................................................................................................................2
2. Hardware Setup for the ZMOD4410 .............................................................................................................................................................2
3. General Program Flow for Setting up ZMOD44xx Gas Measurements ........................................................................................................3
4. Description of the Programming Example Code ...........................................................................................................................................3
4.1 main Files ...........................................................................................................................................................................................3
4.2 Program Flow to Run the Sensor .......................................................................................................................................................4
5. Using the Example on a Different Hardware Platform ..................................................................................................................................5
5.1 Adaptation for the Target System ......................................................................................................................................................5
5.2 Error Codes ........................................................................................................................................................................................5
6. Revision History ............................................................................................................................................................................................6
List of Figures
Figure 1. ZMOD4410 Evaluation Kit ...................................................................................................................................................................2
Figure 2. File Overview for ZMOD44xx Gas Measurements ..............................................................................................................................3
Figure 3. System Hierarchy ................................................................................................................................................................................5
List of Tables
Table 1. Program Flow ......................................................................................................................................................................................4
ZMOD44xx Programming Manual with ZMOD4410 Example
© 2018 Integrated Device Technology, Inc. 2 June 11, 2018

1. Introduction

The ZMOD44xx Gas Sensor Family is highly configurable in order to meet various application needs. This document describes a general program flow to set up ZMOD44xx gas sensor modules for gas measurements. The term ZMOD44xx refers to any product in the ZMOD44xx Gas Sensor Family such as the ZMOD4410 Gas Sensor Module for TVOC and Indoor Air Quality. In addition, this document describes the function of an example code provided as a C file by IDT for the ZMOD4410, which can be operated using its evaluation kit (EVK). The ZMOD4410 is designed for the detection of total volatile organic compounds (TVOC) and provides an output for an estimated carbon dioxide level (eCO2) and a rating for the indoor air quality (IAQ).
Recommendation: Read the datasheet for the specific ZMOD44xx product before using this manual.

2. Hardware Setup for the ZMOD4410

To implement the ZMOD44xx sensor with the user’s program, specific hardware is needed. The example below shows the ZMOD4410 EVK, which consist of three components:
ZMOD44xx HiCom Communication Board ZMOD4410 Sensor Board (Daughter Board) with the ZMOD4410 Gas Sensor Module Micro-USB cable
Refer to the ZMOD4410 Evaluation Kit Description for instructions on assembly, connections, and installation of hardware and software. Figure 1 shows the assembled evaluation kit.
Figure 1. ZMOD4410 Evaluation Kit
USB Cable to
Computer
ZMOD44xx HiCom
Communication Board
ZMOD4410
Sensor Board
ZMOD44xx Programming Manual with ZMOD4410 Example
© 2018 Integrated Device Technology, Inc. 3 June 11, 2018

3. General Program Flow for Setting up ZMOD44xx Gas Measurements

To operate the ZMOD44xx in the hardware and use its full functionality, four code blocks are needed as illustrated in Figure 2:
The “Target Specific I2C and Low-Level Functions” block is the hardware-specific implementation of the I2C interface, it contains read and
write functions to communicate with the ZMOD44xx. If the IDT EVK is used, files for the Hi Com Communication Board are provided with this manual. Custom microcontrollers can be used to establish I2C communication.
The “Application Programming Interface (API)” block contains the functions needed to work with the ZMOD44xx. A detailed description of
the API can be found in the document: ZMOD44xx_API.pdf.
The “Programming Example” block provides a code example that is used to initialize the ZMOD4410 gas sensor module, operate it at a
constant temperature of 300°C, and display the data for TVOC, IAQ, and eCO2. Further details can be found in section 4 of this document.
The “Libraries” block contains the functions and data structures needed to calculate eCO2, IAQ, and TVOC. The libraries are described in
more detail in the document ZMOD44xx_gas_lib.pdf.
To avoid naming conflicts, all function names start with the prefix “zmod44xx_” in the ZMOD44xx code. This naming applies to all products
in the ZMOD44xx product family.
Figure 2. File Overview for ZMOD44xx Gas Measurements
HiCom Low Level
Files:
Target Specific I2C
Files:
Application Programming
Interface (API)
Files:
zmod44xx.c zmod44xx.h
zmod44xx_types.h
zmod44xx_config.h
Programming Example
Files:
Documentation: ZMOD44xx_API.pdf
Libraries
Files:
eco2.h
eco2.lib
iaq.h iaq.lib r_cda.h
r_cda.lib tvoc.h
tvoc.lib
Target Specific I2C and
Low-Level Functions
Documentation: ZMOD44xx_gas_lib.pdf
IDT Evaluation Kit
Customer-Specific Microcontroller
hicom.c
hicom.h
hicom_i2c.c
hicom_i2c.h
main.c main.h

4. Description of the Programming Example Code

The following section describes the example code and how to use the ZMOD4410 Gas Sensor Module. In the example, the ZMOD4410 is initialized and configured for continuous operation at 300°C, and then it displays measured values. The example is intended to work on a Windows® (trademark of Microsoft, Inc.) computer in combination with the IDT gas sensor EVK. However, the example can be adjusted to operate on other platforms such as ARM® (trademark of ARM, Ltd.) and Linux® (trademark of Linus Torvalds).
To run the example using the EVK without further configuration, run ZMOD44xx_example.exe, which is included in the kit software.
4.1
main
Files
The main.c / main.h files contain the main program flow.
The TVOC, IAQ, and eCO2 algorithm is configured by setting the parameters according to the TVOC (IAQ, eCO2) library. Then the target specific initializations are performed. The ZMOD4410 is configured by reading the Final Module Test parameters from the sensors nonvolatile memory (NVM) and initializing it to run continuously at 300 °C.
An endless loop continuously checks the status of the ZMOD4410 and reads its data. The raw data is subsequently processed, and the TVOC, IAQ, and eCO2 values are calculated. All values are shown in a command line window. To stop the loop, press any key, which releases the hardware and stops the program.
ZMOD44xx Programming Manual with ZMOD4410 Example
© 2018 Integrated Device Technology, Inc. 4 June 11, 2018

4.2 Program Flow to Run the Sensor

Refer to the example code for more details.
Table 1. Program Flow
Note: In the following table, lines that are shaded blue can be run in an endless loop with polling or interrupt usage.
Line
Program Actions
Notes
API Functions
1
Reset the sensor.
Before configuring the sensor, it is necessary to reset the sensor by powering it off/on or toggling the reset pin.
-
2
Read device parameters from the nonvolatile memory (NVM).
This step is necessary to choose the correct configuration for the sensor.
zmod44xx_read_sensor_info
3
Initial initialization.
This function must be called after every startup.
zmod44xx_init_sensor
4
Initialize the sensor for TVOC (IAQ, eCO2) measurements.
Initialize the sensor to run at 300°C.
zmod44xx_init_measurement
5
Start the measurement.
Start the measurement.
zmod44xx_start_measurement
6
Read status register.
Wait until the initialization is ready.
zmod44xx_read_status
7
Read status register.
Wait until the measurement is done. This will also be signaled by an interrupt.
zmod44xx_read_status
8
Get the MOx resistance value.
zmod44xx_read_rmox
9
Read status register.
Wait until the sensor is ready.
zmod44xx_read_status
ZMOD44xx Programming Manual with ZMOD4410 Example
© 2018 Integrated Device Technology, Inc. 5 June 11, 2018

5. Using the Example on a Different Hardware Platform

To incorporate this programming example into a different hardware platform, it is necessary to set the device’s struct pointers read, write and delay_ms. The type definitions of the function pointers can be found in zmod44xx_types.h (see Figure 2). The functions read and write should
point to the I2C implementation of the hardware used.
In addition, IDT provides precompiled algorithm libraries that are hardware-platform dependent. IDT offers a download of these libraries for x86/x64 (Linux/Windows) as well as for ARM and MSP microcontrollers.

5.1 Adaptation for the Target System

IDT’s ZMOD44xx C API is located between the application and the target hardware.
Figure 3. System Hierarchy
Application-Specific Algorithm
Application-Specific ZMOD44xx Configuration
ZMOD44xx API and Libraries
Low-Level I2C Communication
Low-level Hardware Functions
Target Hardware
The low-level I2C functions are implemented in the file hicom_i2c.c (see Figure 2) for the EVK hardware running on a Windows-based computer and the HiCom Communication Board.

5.2 Error Codes

Most of the API functions return a code to indicate the success of the operation. If no error occurred, the return code is 0. In the event of an error, a number not equal to zero is returned. The API has predefined symbols ZMOD44XX_ERROR_* for the error codes defined in zmod44xx_types.h.
ZMOD44xx Programming Manual with ZMOD4410 Example
© 2018 Integrated Device Technology, Inc. 6 June 11, 2018

6. Revision History

Revision Date
Description of Change
June 11, 2018
Initial release.
Corporate Headquarters
6024 Silver Creek Valley Road San Jose, CA 95138
www.IDT.com
Sales
1-800-345-7015 or 408-284-8200 Fax: 408-284-2775
www.IDT.com/go/sales
Tech Support
www.IDT.com/go/support
DISCLAIMER Integrated Device Technology, Inc. (IDT) and its affiliated companies (herein referred to as “IDT”) reserve the right to modify the products an d/or specifications described herein at any time, without notice, at IDT's sole discretion. Performance specifications and operatin g parameters of the described products are determined in an independent state and are not guaranteed to perform the same way when installed in customer products. The information contained herein is provided without representation or warranty of a ny kind, whether express or implied, including, but not limited to, the suitability of IDT's products for any particular purpose, an implied warranty of merchantability, or non -infringement of the intellectual property rights of others. This document is presented on ly as a guide and does not convey any license under intellectual property rights of IDT or any third parties.
IDT's products are not intended for use in applications involving extreme environmental conditions or in life support systems or similar devices where the failure or malfunction of an IDT product can be reasonably expected to significantly affect the health or safety of users. Anyone using an IDT product in such a manner does so at their own risk, absent an express, written agreement by IDT.
Integrated Device Technology, IDT and the IDT logo are trademarks or registered trademarks of IDT and its subsidiaries in the Unit ed States and other countries. Other trademarks used herein are the property of IDT or their respective third party owners. For datasheet type definitions and a glossary of common terms, visit www.idt.com/go/glossary. All contents of this document are copyright of Integrated Device Technology, Inc. All rights reserved.
ZMOD44xx-API Documentation
CONTENTS i
Contents
1 ZMOD44xx Application Programming Interface Overview 1
2 Module Index 2
2.1 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3 Data Structure Index 3
3.1 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4 File Index 4
4.1 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5 Module Documentation 5
5.1 Gas sensor IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.2 Error codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.2.1 ERROR_CONFIG_MISSING . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.2.2 ERROR_GAS_TIMEOUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.2.3 ERROR_I2C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.2.4 ERROR_INIT_OUT_OF_RANGE . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.2.5 ERROR_SENSOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5.2.2.6 ERROR_SENSOR_UNSUPPORTED . . . . . . . . . . . . . . . . . . . . . . . 6
© 2018 Integrated Device Technology, Inc. June 14, 2018
CONTENTS ii
6 Data Structure Documentation 7
6.1 zmod44xx_conf Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.2 zmod44xx_conf_str Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.3 zmod44xx_dev_t Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.3.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.3.2.1 config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.3.2.2 delay_ms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.3.2.3 i2c_addr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.3.2.4 mox_er . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.3.2.5 mox_lr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.3.2.6 pid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.3.2.7 read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.3.2.8 write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
7 File Documentation 10
7.1 zmod44xx.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
7.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
7.1.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
7.1.2.1 zmod44xx_init_measurement(zmod44xx_dev_t dev) . . . . . . . . . . . . . . 11
7.1.2.2 zmod44xx_init_sensor(zmod44xx_dev_t dev) . . . . . . . . . . . . . . . . . . 11
7.1.2.3 zmod44xx_read_rmox(zmod44xx_dev_t dev, float rmox) . . . . . . . . . . . . 11
7.1.2.4 zmod44xx_read_sensor_info(zmod44xx_dev_t dev) . . . . . . . . . . . . . . . 12
7.1.2.5 zmod44xx_read_status(zmod44xx_dev_t dev, uint8_t status) . . . . . . . . . 12
7.1.2.6 zmod44xx_start_measurement(zmod44xx_dev_t dev) . . . . . . . . . . . . . 13
7.2 zmod44xx.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
7.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
© 2018 Integrated Device Technology, Inc. June 14, 2018
CONTENTS iii
7.2.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
7.2.2.1 zmod44xx_init_measurement(zmod44xx_dev_t dev) . . . . . . . . . . . . . . 14
7.2.2.2 zmod44xx_init_sensor(zmod44xx_dev_t dev) . . . . . . . . . . . . . . . . . . 15
7.2.2.3 zmod44xx_read_rmox(zmod44xx_dev_t dev, float rmox) . . . . . . . . . . . . 15
7.2.2.4 zmod44xx_read_sensor_info(zmod44xx_dev_t dev) . . . . . . . . . . . . . . . 15
7.2.2.5 zmod44xx_read_status(zmod44xx_dev_t dev, uint8_t status) . . . . . . . . . 16
7.2.2.6 zmod44xx_start_measurement(zmod44xx_dev_t dev) . . . . . . . . . . . . . 16
7.3 zmod44xx_config.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.4 zmod44xx_types.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
7.4.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.4.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7.4.2.1 ZMOD44XX_OK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
© 2018 Integrated Device Technology, Inc. June 14, 2018
ZMOD44xx Application Programming Interface Overview 1
HiCom Low Level
Files:
Target Specic I2C
Files:
Applicaon Programming
Interface (API)
Files:
zmod44xx.c zmod44xx.h
zmod44xx_types.h
zmod44xx_con
g.h
Programming Example
Files:
Documentaon: ZMOD44xx-API.pdf
Libraries
Files:
eco2.h eco2.lib iaq.h iaq.lib r_cda.h r_cda.lib tvoc.h tvoc.lib
Target Speci
c I2C and
Low-Level Func
ons
Documentaon: ZMOD44xx-gas-lib.pdf
IDT Evaluaon Kit
Customer-Specic Microcontroller
hicom.c hicom.h
hicom_i2c.c hicom_i2c.h
main.c main.h
Chapter 1
ZMOD44xx Application Programming Interface Overview
This document refers to the IDT document ZMOD44xx Programming Manual with ZMOD4410 Example. The figure below shows an overview of the ZMOD44xx example, API and libraries. The following describes in detail the Application Programming Interface (API) of the ZMOD44xx.
© 2018 Integrated Device Technology, Inc. June 14, 2018
Module Index 2
Chapter 2
Module Index
2.1 Modules
Here is a list of all modules:
Gas sensor IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Error codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
© 2018 Integrated Device Technology, Inc. June 14, 2018
Data Structure Index 3
Chapter 3
Data Structure Index
3.1 Data Structures
Here are the data structures with brief descriptions:
zmod44xx_conf
Structure to hold the gas sensor module configuration . . . . . . . . . . . . . . . . . . . . . . 7
zmod44xx_conf_str
A single data set for the configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
zmod44xx_dev_t
Device structure ZMOD44xx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
© 2018 Integrated Device Technology, Inc. June 14, 2018
File Index 4
Chapter 4
File Index
4.1 File List
Here is a list of all documented files with brief descriptions:
zmod44xx.c
ZMOD44xx functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
zmod44xx.h
ZMOD44xx functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
zmod44xx_config.h
ZMOD44xx configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
zmod44xx_types.h
ZMOD44xx types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
© 2018 Integrated Device Technology, Inc. June 14, 2018
Loading...
+ 31 hidden pages