ENGLISH 简体中文 日本語 한국어  

    로그인 | 회원가입 


   
 
키워드나 부품번호를 입력해주세요    




애플리케이션 노트 502

Interfacing SPI Real-Time Clocks (RTCs) with a Microcontroller

Abstract: Dallas Semiconductor/Maxim offers a variety of serial real-time clocks (RTCs). Several of these RTCs use the industry-standard Motorola SPI interface to communicate with a microprocessor. This application note helps customers understand the basics of the SPI interface.

Overview

The SPI standard includes four modes, defined by the polarity of SCLK and the phase relationship between data and SCLK. The clock polarity (CPOL) is determined by the idle state of SCLK. If the idle state is low, CPOL is 0. If the idle state is high, CPOL is 1. The clock phase (CPHA) is determined by which edge that data is valid. If the data is valid on the first edge of SCLK, CPHA is 0. If the data is valid on the second edge of SCLK, CPHA is 1.

Industry has two common formats to define the four SPI modes. The first format defines the four possible combinations of phase and polarity as mode 0, mode 1, mode 2, and mode 3. The second format defines the combinations as mode 0,0, mode 0,1, mode 1,0, and mode 1,1. The SPI master must use a mode supported by the slave device to allow proper communications.

Dallas Semiconductor/Maxim's SPI-interface RTCs support both SCLK polarities. The RTC automatically determines the polarity by detecting the idle state of SCLK when CE is asserted. The master must, therefore, place SCLK in the proper idle state before CE is asserted. Only one phase is supported. Since two SCLK polarities are supported, two of the four SPI modes are supported by the RTCs: modes 1 and 3 (mode 0,1 and mode 1,1).

On microcontrollers with built-in SPI interfaces, an SPI control or configuration register will have bits that control the polarity and phase. Because the RTC supports either polarity, the polarity can be set as desired. The phase bit, however, must be set properly, or the RTC will not operate correctly.

Figure 1 shows a typical single-byte read and Figure 2 shows a typical single-byte write. Each time CE is asserted, the first eight SCLK pulses are used to clock in a command byte. The command byte consists of several bits that define a register address, and one bit that defines the data direction: a write if the next eight SCLK pulses will clock data into the part, or a read if data is clocked out of the part. Additional groups of eight SCLK pulses continue to transfer data in the selected direction until CE is deasserted.

Figure 1. Single-byte read.
Note: In burst mode, CE is kept high and additional SCLK cycles are sent until the end of the burst.
Figure 1. Single-byte read.

Figure 2. Single-byte write.
Note: In burst mode, CE is kept high and additional SCLK cycles are sent until the end of the burst.
Figure 2. Single-byte write.

Examples of SPI code are available at: Real-Time Clocks

Summary

The information in this application note will help ensure that SPI communication routines will function correctly.


관련 부품  APP 502: May 22, 2001
DS1305 직렬 경보 실시간 클록 전체 데이터 시트
(PDF, 496kB)
무료 샘플
DS1306 직렬 경보 실시간 클록 전체 데이터 시트
(PDF, 388kB)
무료 샘플
DS1390 트리클 충전기가 내장된 저전압 SPI/3-Wire RTC 전체 데이터 시트
(PDF, 388kB)
무료 샘플
DS1391 트리클 충전기가 내장된 저전압 SPI/3-Wire RTC 전체 데이터 시트
(PDF, 388kB)
무료 샘플
DS3234 크리스털과 SRAM이 내장된 초정밀 SPI 버스 RTC 전체 데이터 시트
(PDF, 300kB)
무료 샘플
MAX6902 TDFN 패키지로 제공되는 SPI 호환 RTC 전체 데이터 시트
(PDF, 200kB)
무료 샘플
MAX6916 마이크로프로세서 감시소자, 알람 기능 및 NV RAM 컨트롤러가 내장된 SPI 호환 RTC 전체 데이터 시트
(PDF, 340kB)

자동 업데이트
관심 분야의 애플리케이션 노트가 나올 때 자동으로 업데이트를 원하십니까? 그렇다면 EE-Mail™을 신청하십시오.


We Want Your Feedback!



의견을 보내주세요!
위 내용이 도움이 되셨나요?
여러분의 의견을 기다립니다 — Maxim은 보내주신 정정이나 제안사항을 반영하고 있습니다. 이 페이지를 평가하고 의견을 보내주십시오.

 

다운로드, PDF 형식다운로드, PDF 형식 (61kB)
 AN502, AN 502, APP502, Appnote502, Appnote 502

        •         •         •     개인정보보호 정책     •     법적 고지

    Copyright © 2009 by Maxim Integrated Products