AN510 Using SPI protocol with pressure sensor modules

Similar documents
Sample board for USB DEVELOPPER KIT

USBDEVELKIT DEVELOPMENT KIT V3

Application Note TSYS01

MS4525DO DESCRIPTION STANDARD RANGE (PSI)

D-Series Inclinometer

MS5534C Barometer Module

4515DO DESCRIPTION STANDARD RANGES(IN H20)

MS BA Variometer Module

TSYS01-FAMILY Digital Temperature Sensors

MS BA Miniature Altimeter Module

Section 5 SERCOM. Tasks SPI. In this section you will learn:

Please refer to "4. Evaluation Board" on page 2 for more information about these steps. Figure 1. System Connections

MS5536C SMD Gage Pressure Module

AN10428 UART-SPI Gateway for Philips SPI slave bridges

Microcontrollers and Interfacing

MS BA Miniature Altimeter and Diving Module

MEAS Model HTU21D DemoBoard USB Stick 4in1

An SPI Temperature Sensor Interface with the Z8 Encore! SPI Bus

FX1901 OEM Compression Load Cell

SPI Overview and Operation

U7100 Pressure Transducer

AN2737 Application note Basic in-application programming example using the STM8 I 2 C and SPI peripherals Introduction

Serial Peripheral Interface. What is it? Basic SPI. Capabilities. Protocol. Pros and Cons. Uses

Embedded Systems and Software. Serial Interconnect Buses I 2 C (SMB) and SPI

Understanding SPI with Precision Data Converters

ETHERNET INTELLIGENT PRESSURE SCANNER

Interfacing the HI7190 to a Microcontroller

AppNote-US2400-EVB Low Power 2.4GHz Transceiver

MS BA Altimeter Module

D-SERIES INCLINOMETER

a Serial Peripheral Interace (SPI). Embedded RISC Microcontroller Core Peripheral

Software library for MS5534 and MS5535

MS BA01 PHT Fusion Sensor

FEATURES FIEL OF APPLICATION Mobile altimeter / barometer systems ike computers Adventure or multi-mode watches Variometers ataloggers TECHNICAL ATA S

IPPS-015 series Intelligent Pressure Sensor

Table of Contents 1 Typical Applications General Description Block Diagram Pinout System Connections Typical A

MC3635 FEATURES GENERAL DESCRIPTION

USER GUIDE EDBG. Description

Using IIC to Read ADC Values on MC9S08QG8

M7100 Pressure Transducer

EDBG. Description. Programmers and Debuggers USER GUIDE

From Datasheets to Digital Logic. synthesizing an FPGA SPI slave from the gates

MEAS TEMPERATURE SYSTEM SENSOR (TSYS01) XPLAINED PRO BOARD

< W3150A+ / W5100 Application Note for SPI >

ZSSC4151 Evaluation Kit Hardware Manual

MS5561C Micro Altimeter

UART TO SPI SPECIFICATION

EPL COM / 132 SEG LCD

Application Note. Interfacing the CS5521/22/23/24/28 to the 68HC05. Figure 1. 3-Wire and 4-Wire Interfaces

Interfacing Techniques in Embedded Systems

Introduction to I2C & SPI. Chapter 22

APPLICATION NOTE. Atmel AT02260: Driving AT42QT1085. Atmel QTouch. Features. Description

± 2g Tri-axis Accelerometer Specifications

AND9032. How to Read Temperature Through I 2 C Bus for NCT75-based Thermostat APPLICATION NOTE

8-bit Microcontroller. Application Note. AVR320: Software SPI Master

DIGISENSOR CO., LTD Tel.: (848) Website :

The 9S12 Serial Peripheral Inteface (SPI) Huang Section 10.2 through 10.6 SPI Block User Guide

Emulating I2C Bus Master by using FlexIO

Atmel ATMXT143E touchscreen controller Capacitive touch ITO 320 x 240 pixel LCD display with SPI interface LED backlight

SPI bus communication with LDE/LME pressure sensors

Serial Peripheral Interface (SPI) Host Controller Data Sheet

PARALLEL COMMUNICATIONS

1.3inch OLED User Manual

Amarjeet Singh. January 30, 2012

FM Bytes Memory Card Chip. Datasheet. Dec Datasheet. FM Bytes Memory Card Chip Ver 3.0 1

EE 456 Fall, Table 1 SPI bus signals. Figure 1 SPI Bus exchange of information between a master and a slave.

i_csn i_wr i_rd i_cpol i_cpha i_lsb_first i_data [15:0] o_data [15:0] o_tx_ready o_rx_ready o_rx_error o_tx_error o_tx_ack o_tx_no_ack

ULTIMATE-PRECISION DIGITAL LBB

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

SILICON MICROSTRUCTURES

MP-2000 Dual Channel LVDT/RVDT Readout/Controller

ZSC31xxx / ZSSC3xxx. SSC Communication Board. Datasheet. Brief Description. Features. Benefits

DIGISENSOR CO., LTD MDS COMPASS DEPTH METER & ALTIMETER MODULE. Description. Application

Markus Hintermann Global Technical Marketing / Sales Manager at Micro Crystal

Emulating I2S bus on KE06

An SPI interface for the 65(C)02 family of microprocessors

Arduino Uno R3 INTRODUCTION

UM PCAL6524 demonstration board OM Document information

SN8F5000 Starter-Kit User Manual

UART. Embedded RISC Microcontroller Core Peripheral

HT24LC02. CMOS 2K 2-Wire Serial EEPROM. Pin Assignment. Features. General Description. Block Diagram. Pin Description

ugreen DAB Board Instructions v5

SBAT90USB162 Atmel. SBAT90USB162 Development Board User s Manual

MAG3110 Frequently Asked Questions

ams AG austriamicrosystems AG is now The technical content of this austriamicrosystems document is still valid. Contact information:

MS C SMD Gage Pressure Module

MS5525DSO (Digital Small Outline)

Low Voltage, 10-Bit Digital Temperature Sensor in 8-Lead MSOP AD7314

AT89S4D12. 8-Bit Microcontroller with 132K Bytes Flash Data Memory AT89S4D12. Features. Description. Pin Configurations

CE56273 Associated Part Families: CY8C38xx/CY8C55xx Software: PSoC Creator Related Hardware: CY8CKIT-001 Author: Anu M D

Revision History. Version Date Changes Error in PIN description SPI jack Initial version

MEAS HTU21D PERIPHERAL MODULE

DPL/DPN-Series Inclinometer

SPI (Serial & Peripheral Interface)

Input MUX. dig. Filter ADC. Sensor Interface IC

The EFM32 I2C module allows simple, robust and cost effective communication between integrated circuits using only one data and one clock line.

PIC Serial Peripheral Interface (SPI) to Digital Pot

Dot Matrix LCD Controller Driver

Microcontrollers and Interfacing week 10 exercises

Lecture 14 Serial Peripheral Interface

Transcription:

1 USING SPI PROTOCOL WITH PRESSURE SENSOR MODULES This application note describes the possibility of communication between a microcontroller and MEAS Switzerland's pressure sensor modules (MS55XX series) via SPI protocol. SPI stands for Serial Peripheral Interface. It is frequently used when few I/O lines are available, but communication between two or more devices must be fast and easy to implement. SPI is a synchronous protocol that allows a master device to initiate communication with a slave device. It is implemented in many standard microprocessors (Microchip, Silicon Laboratories, Atmel, ST, ) by a hardware module. The great advantage of using this protocol is it simplifies the communication with the sensor module. In fact, there is no need to generate the serial clock, as it is generated by the microcontroller. You only have to place data and commands in a buffer and the microcontroller send it. (Same utilization than an USART) This protocol needs a minimum of three lines between the master and a slave. An additional line must be added for each slave in multi-slave operations in order to select it. MASTER MISO Shift register MOSI Shift register R/W Control SCLK Control R/W The communication between a master and a slave is always a data transfer. When the master sends something, it will receive a data at the same time. If the data received is not read, it will be lost at next data transfer. When the master wants to receive something, it has to send a dummy data to shift the answer placed in the slave s shift register. For more details about SPI, refer to microcontroller datasheet. Applicno1918ECN1509 1/9

2 HARDWARE: COMMUNICATION BETWEEN THE MASTER AND ONE SLAVE OSC Microcontroller OSCin MISO or SDI MOSI or SDO SCL MCL DOUT DIN SCKL MS 55XX sensor With: MISO = Master In & Slave Out MOSI = Master Out & Slave In SDO = Serial Data Out SDI = Serial Data In SCL or SCKL = Serial Clock OSC = Oscillator at 32.768 khz For ex: SG3030JC Note: The oscillator is not necessary for data transmission but for sensor ADC. It can be used as clock for the microcontroller too. Applicno1918ECN1509 2/9

3 HARDWARE: COMMUNICATION BETWEEN THE MASTER AND TWO OR MORE SLAVES MISO or SDI 3 lines of the bus SPI MOSI or SDO Microcontroller CS1 CS2 CS3 SCL Chip Select MS55XX OE IC DOUT DIN SCLK CS CS OSC MS 55XX sensor Other slaves (EEPROM, LCD, RTC, other sensors, ) With: CS = Chip Select (Or slave select SS) IC = 3-State buffer (high-z driver) For ex: 74HC1G125 OSC = Oscillator at 32.768 khz For ex: SG3030JC Remarks: - As MEAS Switzerland s sensor modules haven t any high-z driver on DOUT, it is compulsory to add a 3-state buffer on the line between DOUT and MISO-line of the SPI bus in order to allow communication with the other slaves. - The lines MISO, MOSI and SCL have to be connected on the right ports of the microcontroller (See microcontroller datasheet). The CSx lines can be connected to general digital I/O. - Most components using SPI have an active-low input (CS\) to select it. Using a 74HC1G125 has the same meaning because this driver has an Output-Enable active-low input(oe\). Applicno1918ECN1509 3/9

4 SOFTWARE Example: reading calibration words 2 and 4 on a MS5534-B SCLK Calibration data read out sequence for word 2/ word 4: DOUT coefficient-data out MSB DB7 DB6 DB5 DB4 DB3 DB2 DB1 coefficient-data out LSB DB0 DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 DIN Bit0 Bit1 Bit2 Start-bit sequence: coefficient read + address Bit3 Bit4 Bit5 Bit6 Bit7 Bit8 Bit9 Bit10 Bit11 Setup-bits Stop-bit address word 2 address word 4 (Extract from MS5534C datasheet, Fig. 6d page 14) The frame to be sent is 1-1-1-0-1-0-1-1-0-0-0-0 (for calibration word 2) With SPI protocol, it is only possible to send 8 bits at a time (one byte). The frame must be divided by two and some 0 must be placed before and after the frame to complete the two bytes. It becomes: 0-0-0-1-1-1-0-1-0-1-1-0-0-0-0-0 Separated in bytes: 0-0-0-1-1-1-0-1 0-1-1-0-0-0-0-0 In Hexadecimal: 1Dh 60h Remark: The 0 added after the frame is placed to have one more clock after the stop bits on the SCLK line. (As shown on the scope above) Applicno1918ECN1509 4/9

Thus, the other frame becomes: Conversion start for pressure measurement (D1): Conversion start for temperature measurement (D2): Read calibration word 1 (W1): Read calibration word 2 (W2): Read calibration word 3 (W3): Read calibration word 4 (W4): Reset sequence command: 0Fh & 40h 0Fh & 20h 1Dh & 50h 1Dh & 60h 1Dh & 90h 1Dh & A0h 15h & 55h & 40h With SPI protocol, two parameters need to be checked or adjusted during the configuration of microcontroller s SPI module: Clock Idle state must be low. Transmission must occur on rising edge of the serial clock when the microcontroller wants to send data received by the sensor. On the other side, when the microcontroller wants to receive data sent by the sensor transmission must occur on the falling edge of the clock. ucontroller Sensor Sclk Send Receive Receive Send (See the scopes shown on the page before to have an example) Applicno1918ECN1509 5/9

5 EXAMPLES OF FLOW CHARTS READING CALIBRATION WORD 1: Read calibration word 1 Set the right CS line to 0 the rising edge of the clock Send the 8 MSB of the command «read cal word 1»: 1Dh Send the 8 LSB of the command «read cal word 1»: 50h the falling edge of the clock Send a dummy byte to read the 8 MSB of the word 1 Send a dummy byte to read the 8 LSB of the word 1 Set the right CS line to 1 Word_1 = 8MSB_of_W1<<8 & 8LSB_of_W1 Reading calibration words 2-4: The flowchart is the same. The differences are the commands. Note: To optimize code, read the four calibration words in a loop. Applicno1918ECN1509 6/9

READING PRESSURE VALUE (D1): Read pressure measurement (D1) Set the right CS line to 0 the rising edge of the clock Send the 8 MSB of the command «Read press meas» : 0Fh Send the 8 LSB of the command «Read press meas» : 40h the falling edge of the clock Wait 35ms (conversion time) Send a dummy byte to read the 8 MSB of D1 Send a dummy byte to read the 8 LSB of D1 Set the right CS line to 1 D1 = 8MSB_of_D1<<8 & 8LSB_of_D1 READING TEMPERATURE VALUE (D2): The flowchart is the same. The differences are the commands (0Fh and 20h instead of 0Fh and 40h) Applicno1918ECN1509 7/9

RESET SEQUENCE COMMAND: Reset sequence command Set the right CS line to 0 the rising edge of the clock Send the 8 MSB of the command «Rst seq» : 15h Send the middle byte of the command : 55h Send the 8 LSB of the command «Rst seq» : 40h Set the right CS line to 1 Applicno1918ECN1509 8/9

REVISION HISTORY Date Revision Type of changes November 09, 2005 V1.0 Initial release March 9, 2011 002 Change to MEAS logo and layout June 20, 2011 003 Insertion of the mention TM in the logo, modification of Shenzhen zip code FACTORY CONTACTS NORTH AMERICA EUROPE ASIA Measurement Specialties 45738 Northport Loop West Fremont, CA 94538 Tel: +1 800 767 1888 Fax: +1 510 498 1578 e-mail: pfg.cs.amer chameasspec.com Website: www.meas-spec.com MEAS Switzerland Sàrl Ch. Chapons-des-Prés 11 CH-2022 Bevaix Tel: +41 32 847 9550 Fax: + 41 32 847 9569 e-mail: sales.chameas-spec.com Website: www.meas-spec.com Measurement Specialties (China), Ltd. No. 26 Langshan Road Shenzhen High-Tech Park (North) Nanshan District, Shenzhen, 518057 China Tel: +86 755 3330 5088 Fax: +86 755 3330 5099 e-mail: pfg.cs.asiaameas-spec.com Website: www.meas-spec.com The information in this sheet has been carefully reviewed and is believed to be accurate; however, no responsibility is assumed for inaccuracies. Furthermore, this information does not convey to the purchaser of such devices any license under the patent rights to the manufacturer. Measurement Specialties, Inc. reserves the right to make changes without further notice to any product herein. Measurement Specialties, Inc. makes no warranty, representation or guarantee regarding the suitability of its product for any particular purpose, nor does Measurement Specialties, Inc. assume any liability arising out of the application or use of any product or circuit and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Typical parameters can and do vary in different applications. All operating parameters must be validated for each customer application by customer s technical experts. Measurement Specialties, Inc. does not convey any license under its patent rights nor the rights of others. Applicno1918ECN1509 9/9