AN-1250: Interfacing an ADT7310/ADT7410 to a Cortex-M3 Based Precision Analog Microcontroller (ADuCM360) PDF

AN-1250
APPLICATION NOTE
One Technology Way • P.O. Box 9106 • Norwood, MA 02062-9106, U.S.A. • Tel: 781.329.4700 • Fax: 781.461.3113 • www.analog.com
Interfacing an ADT7310/ADT7410 to a Cortex-M3 Based Precision Analog
Microcontroller (ADuCM360)
By Aude Richard
INTRODUCTION
This application note also includes example code showing
how a microcontroller and temperature sensor can communicate with each other using the I2C and SPI interface. Simple
functions to control the ADT7310 and ADT7410 are available.
See the AN-1250 companion code zip file available on the
analog.com website.
11715-001
This application note describes how to connect evaluation
boards and how to easily start collecting high accuracy, digital
temperature readings from the ADT7310 and ADT7410 sensors
using the Cortex-M3® based precision Analog Devices Inc.,
microcontrollers, such as the ADuCM360.
Figure 1. EVAL-ADuCM360QSPZ Connected to EVAL-ADT7X10EBZ
Rev. 0 | Page 1 of 8
AN-1250
Application Note
TABLE OF CONTENTS
Introduction ...................................................................................... 1
ADuCM360 Evaluation Board ....................................................4
Revision History ............................................................................... 2
Companion Code ..............................................................................5
Interfacing the Evaluation Boards .................................................. 3
Using the Demo Code ..................................................................5
ADT7310 Evaluation Board ........................................................ 3
Demo Code Flowchart .................................................................5
ADT7410 Evaluation Board ........................................................ 3
Interface Functions .......................................................................5
REVISION HISTORY
9/13—Revision 0: Initial Version
Rev. 0 | Page 2 of 8
Application Note
AN-1250
INTERFACING THE EVALUATION BOARDS
Analog Devices offers evaluation boards that allow quick
prototyping of an application. For example, consider the
ADuCM360 (EVAL-ADuCM360QSPZ) and ADT7310 and
ADT7410 (EVAL-ADT7x10EBZ) evaluation boards.
ADT7410 EVALUATION BOARD
Figure 1 shows EVAL-ADuCM360QSPZ connected to
EVAL-ADT7x10EBZ.
Table 2. Connector Signals on ADT7410 Evaluation Board
Table 2 lists the signals available on the ADT7410 evaluation
board connector for quick prototyping.
Table 1 lists the signals available on the ADT7310 evaluation
board connector for quick prototyping.
Table 1. Connector Signals on ADT7310 Evaluation Board
J1 Pin
1
Signal
VDD
2
3
GND
SCLK
4
DOUT
5
DIN
6
CS
Description
Positive Supply Voltage (2.7 V to 5.5 V).
Decouple the supply with a 0.1 µF ceramic
capacitor to ground.
Analog and Digital Ground.
Serial Clock Input.
The serial clock is used to clock in and clock
out data to and from any register of the
ADT7310.
Serial Data Output.
Data is clocked out on the SCLK falling edge
and is valid on the SCLK rising edge.
Serial Data Input.
Serial data to be loaded to the control
registers is provided on this input. Data is
clocked into the registers on the rising edge
of SCLK.
Chip Select Input.
The device is selected when this input is
low. The device is disabled when this pin is
high.
Signal
VDD
2
3
GND
SCL
4
SDA
5
A0
6
A1
Note that it is important to check the microcontroller supply
range. For example, the ADuCM360 supply range is 1.8 V
to 3.6 V.
Figure 3 shows typical I2C connections between the master and
the ADT7410.
3.3V
ADuCM360
Note that it is important to check the microcontroller supply
range. For example, the ADuCM360 supply range is 1.8 V
to 3.6 V.
Figure 2 shows typical SPI connections between the master and
the ADT7310.
SCL
DOUT
DIN
CS
SCLK
DIN
DOUT
CS
VDD
CT
INT
GND
10kΩ
10kΩ
Figure 2. An ADuCM360 (Master) with Single ADT7310 (Slave)
SPI Block
PULL-UP
RESISTORS
ADT7410
SCL
SCL
VDD
SDA
SDA
CT
A0
INT
A1
GND
10kΩ
10kΩ
Figure 3. An ADuCM360 (Master) with Single ADT7410 (Slave)
I2C Block
ADT7310
11715-003
ADuCM360
Description
Positive Supply Voltage (2.7 V to 5.5 V).
Decouple the supply with a 0.1 µF ceramic
capacitor to ground.
Analog and Digital Ground.
I2C Serial Clock Input.
The serial clock is used to clock in and clock
out data to and from any register on the
ADT7410 open-drain configuration. A pull-up
resistor is required, typically 10 kΩ.
I2C Serial Data Input/Output.
Serial data to and from the part is provided
on this pin. Open-drain configuration. A pullup resistor is required, typically 10 kΩ.
I2C Serial Bus Address Selection Pin.
Logic input. Connect to GND or VDD to set an
I2C address.
I2C Serial Bus Address Selection Pin.
Logic input. Connect to GND or VDD to set an
I2C address.
11715-002
ADT7310 EVALUATION BOARD
J1 Pin
1
External pull-up resistors are recommended on the SCL and
SDA lines. The ADuCM360 typically has internal pull-ups on
GPIOs that can be disabled in software when using the I2C bus.
The companion code demonstrates how to disable the internal
pull-ups.
Rev. 0 | Page 3 of 8
AN-1250
Application Note
ADUCM360 EVALUATION BOARD
The ADuCM360 evaluation boards are mini boards with all
GPIOs available on the edge connectors. Table 3 shows example
connections for the ADuCM360.
J1 Pin
3
4
17
18
19
20
21
22
Signal
DVDD
DGND
P1.4
P1.5
P1.6
P1.7
P2.0
P2.1
Description
Positive Supply Voltage (1.8 V to 3.6 V).
Digital Ground.
SPI0 Port: MISO.
SPI0 Port: SCLK.
SPI0 Port: MOSI.
SPI0 Port: CS.
I2C Port: SCL.
I2C Port: SDA.
11715-004
Table 3. J1 Connector Signals on the ADuCM360 Evaluation
Board (Rev. B)
Figure 4. ADuCM360 Top Side View
Rev. 0 | Page 4 of 8
Application Note
AN-1250
COMPANION CODE
Typically, a project contains three source files and two
definition files to interface the temperature sensors to the
ADuCM360. Table 4 lists these files.
INITIALIZE PERIPHERALS
WATCHDOG TIMER, CLOCKS,
SPI, I2C, AND UART
Table 4. Files Provided
Source and
Definitions
ADT7410I2C.c
ADT7410I2C.h
ADT7310SPI.c
ADT7310SPI.h
ADT7x10_Demo.c
ENABLE INTERRUPTS
SPI, I2C, AND UART
Description
Set of functions to interface the ADuCM360
to ADT7410 via I2C
Functions and parameters definitions to
interface the ADuCM360 to ADT7410 via I2C
Set of functions to interface the ADuCM360
to ADT7410 via SPI
Functions and parameters definitions to
interface the ADuCM360 to ADT7410 via SPI
Example code that calls some of the
functions
CONFIGURE EXTERNAL SENSORS
ADT7410 AND ADT7310
READ SENSOR’S ID
WHILE (1)
USING THE DEMO CODE
GET MEASUREMENTS FROM THE SENSORS
ADT7410 AND ADT7310
After connecting the boards, download code to the ADuCM360
and open a serial port terminal application, such as
HyperTerminal®.
SEND RESULTS VIA UART
Check the UART setting (9600 bps). Figure 5 shows the results
on the serial port.
11715-006
DELAY
Figure 6. Demo Code Flow Chart
ADT7310 Functions
11715-005
These five functions cover the main features of the ADT7310.
Parameters for these functions are defined in the header
file (ADT7310SPI.h). All functions are based on the SPI lowlevel functions of the ADuCM360. Note that some of the
microcontrollers may have more than one SPI. The AN-1248
Application Note, SPI Interface, provides general information
on SPI.
Figure 5. Results on Serial Port
DEMO CODE FLOWCHART
The maximum SPI speed of the ADT7310 is 5 Mbps. For more
information on the ADT7310 features, consult the ADT7310
data sheet.
Figure 6 shows the demo code flowchart. The demo code
configures the sensors in continuous conversion mode. In
continuous mode, a new result is available every 240 ms.
A software delay is used between each request for a temperature
measurement result. This software delay can be replaced with
the timer periodically interrupting the ADuCM360 to read the
sensors measurements.
INTERFACE FUNCTIONS
Table 6 lists all functions included in the ADT7410I2C and
ADT7310SPI files.
ADT7410 Functions
These five functions cover the main features of the ADT7410.
Parameters for these functions, including the sensor address,
are defined in the header file (ADT7410I2C.h). All functions
are based on the I2C low-level functions described in the
AN-1159 Application Note, I2C-Compatible Interface on CortexM3 Based Precision Analog Microcontroller (ADuCxxx Family).
For more information on the ADT7410 features, consult the
ADT7410 data sheet.
Rev. 0 | Page 5 of 8
AN-1250
Application Note
Table 5. ADT7310 Functions Provided
Function Name
int ADT7310_SPICFG (int Resolution, int iMode, int CT, int INT, int
INTCTmode, int Fault_queue);
int ADT7310_SPI_T_Setpoint (int REG_Address, int value);
float ADT7310_SPIGetTemperature (void);
long ADT7310_SPI_Status (char REG_Address);
int ADT7310_Reset (void);
Function Description
Configure the temperature sensor resolution, mode, CT pin
polarity, INT pin polarity, and so on.
Configure one of the four set point register (THIGH,TLOW, TCRIT, or
THYST).
Return temperature measurement in °C.
Return content of the register at REG_Address (status,
configuration, ID, or T_setpoint).
Reset the ADT7310.
Table 6. ADT7410 Functions Provided
Function Name
int ADT7410_I2CCFG (char Address, int Resolution, int iMode, int CT, int
INT, int INTCTmode, int Faultqueue);
int ADT7410_I2C_T_Setpoint (char BusAddress, char REGadd, int RorW,
int Value);
float ADT7410_I2CGetTemperature (char Address, unsigned char
*Status, unsigned char *Config);
int ADT7410_I2CID (char Address);
int ADT7410_I2CReset (char Address);
Function Description
Configure the temperature sensor resolution, mode, CT pin
polarity, INT pin polarity, and so on.
Configure or read back one of the four set point register (THIGH,
TLOW, TCRIT, or THYST).
Return temperature measurement in °C. This function also
updates the status and configuration variables.
Return sensor ID.
Reset the ADT7410.
Limitations
This application note does not cover all features of the
ADT7310 and ADT7410, such as the over and under
temperature detection, because the evaluation boards do not
easily allow access to the INT and CT outputs.
Rev. 0 | Page 6 of 8
Application Note
AN-1250
NOTES
Rev. 0 | Page 7 of 8
AN-1250
Application Note
NOTES
©2013 Analog Devices, Inc. All rights reserved. Trademarks and
registered trademarks are the property of their respective owners.
AN11715-0-9/13(0)
Rev. 0 | Page 8 of 8
Similar pages