Mode | CPOL | CPHA |
---|---|---|
0 | 0 | 0 |
1 | 0 | 1 |
2 | 1 | 0 |
3 | 1 | 1 |
unsigned char SPIBitBang8BitsMode0(unsigned char byte) { unsigned char bit; for (bit = 0; bit < 8; bit++) { /* write MOSI on trailing edge of previous clock */ if (byte & 0x80) SETMOSI(); else CLRMOSI(); byte <<= 1; /* half a clock cycle before leading/rising edge */ SPIDELAY(SPISPEED/2); SETCLK(); /* half a clock cycle before trailing/falling edge */ SPIDELAY(SPISPEED/2); /* read MISO on trailing edge */ byte |= READMISO(); CLRCLK(); } return byte; }
The board real estate savings compared to a parallel I/O bus are significant, and have earned SPI a solid role in embedded systems. That is true for most system-on-a-chip processors, both with higher end 32-bit processors such as those using ARM, MIPS, or PowerPC and with other microcontrollers such as the AVR, PIC, and MSP430. These chips usually include SPI controllers capable of running in either master or slave mode. In-system programmable AVR controllers (including blank ones) can be programmed using an SPI interface.[3]
Chip or FPGA based designs sometimes use SPI to communicate between internal components; on-chip real estate can be as costly as its on-board cousin.
The full-duplex capability makes SPI very simple and efficient for single master/single slave applications. Some devices use the full-duplex mode to implement an efficient, swift data stream for applications such as digital audio, digital signal processing, or telecommunications channels, but most off-the-shelf chips stick to half-duplex request/response protocols.
SPI is used to talk to a variety of peripherals, such as
For high performance systems, FPGAs sometimes use SPI to interface as a slave to a host, as a master to sensors, or for flash memory used to bootstrap if they are SRAM-based.
JTAG is essentially an application stack for a 3-wire SPI flavor, using different signal names[citation needed]: TCK not SCK, TDI not MOSI, TDO not MISO. It defines a state machine (driven by a TMS signal instead of a chip select line), protocol messages, a core command set, the ability to daisy-chain devices in a "scan chain", and how vendors define new commands. The devices in a scan chain are initially treated as a single device, and transitions on TMS update their state machines; once the individual devices are identified, commands may be issued that affect only one device in that scan chain. Different vendors use different JTAG connectors. Bit strings used in JTAG are often long and not multiples of 8 bit words; for example, a boundary scan reports signal state on each of several hundred pins.
SGPIO is essentially another (incompatible) application stack for SPI designed for particular backplane management activities[citation needed]. SGPIO uses 3-bit messages.
The SPI bus is a de facto standard. However, the lack of a formal standard is reflected in a wide variety of protocol options. Different word sizes are common. Every device defines its own protocol, including whether or not it supports commands at all. Some devices are transmit-only; others are receive-only. Chip selects are sometimes active-high rather than active-low. Some protocols send the least significant bit first.
Some devices even have minor variances from the CPOL/CPHA modes described above. Sending data from slave to master may use the opposite clock edge as master to slave. Devices often require extra clock idle time before the first clock or after the last one, or between a command and its response. Some devices have two clocks, one to "capture" or "display" data, and another to clock it into the device. Many of these "capture clocks" run from the chip select line.
Some devices require an additional flow control signal from slave to master, indicating when data are ready. This leads to a "five wire" protocol instead of the usual four. Such a "ready" or "enable" signal is often active-low, and needs to be enabled at key points such as after commands or between words. Without such a signal, data transfer rates may need to be slowed down significantly, or protocols may need to have "dummy bytes" inserted, to accommodate the worst case for the slave response time. Examples include initiating an ADC conversion, addressing the right page of flash memory, and processing enough of a command that device firmware can load the first word of the response. (Many SPI masters don't support that signal directly, and instead rely on fixed delays.)
Many SPI chips only support messages that are multiples of 8 bits. Such chips can not interoperate with the JTAG or SGPIO protocols, or any other protocol that requires messages that are not multiples of 8 bits.
There are even hardware-level differences. Some chips combine MOSI and MISO into a single data line (SI/SO); this is sometimes called "3-Wire" signaling (in contrast to normal "4-wire" SPI). Another SPI flavor removes the chip select line, managing protocol state machine entry/exit using other methods; this isn't usually called 3-Wire though. Anyone needing an external connector for SPI defines their own -- UEXT, JTAG connector, Secure Digital card socket, etc. . Signal levels depend entirely on the chips involved.
번호 | 제목 | 닉네임 | 조회 | 등록일 | |
---|---|---|---|---|---|
SPI(Serial Peripheral Interface Bus ) 통신 [1] | |||||
dwkim |
57092 | 2011-09-07 | |||
SPI bus: single master and single slave A typical hardware setup using two shift registers to form an inter-chip circular buffer A timing diagram showing clock polarity and phase ModeCPOLCPHA000101210311 Typical...
|
|||||
14 | NCQ(Native Command Queuing) | ||||
dwkim |
11592 | 2011-09-06 | |||
[출처 : 위키백과] NCQ(Native Command Queuing)은 특정 상황에서 SATA 장치의 성능을 향상시키기 위해 도입된 기술로, I/O 요청을 우선 큐에 보관한 다음, 전체 헤드의 움직임을 최소화할 수 있도록 요청의 순서를 재배열한 다음 ...
|
|||||
13 | 평균 무고장 시간 (MTBF : Mean Time Between Failures) | ||||
dwkim |
17727 | 2011-09-06 | |||
평균 무고장 시간(MTBF, mean time between failures)는 시스템의 고장 발생 평균 시간을 나타내는 것이다. 평균무고장시간은 밀도 함수 ƒ(t)의 기대값을 사용하여 정의될 수 있다.
|
|||||
12 | SATA | ||||
dwkim |
13233 | 2011-09-06 | |||
[출처: 위키백과] SATA 또는 직렬 ATA(Serial ATA)는 하드 디스크 혹은 광학 드라이브와의 데이터 전송을 주요 목적으로 만든 컴퓨터 버스의 한 가지이다. 흔히 사타라고 읽으며 새터, 세이터라고 발음하기도 한다. SATA는 예전의...
|
|||||
11 | 개발자도 알아야 할 SW 테스팅 실무 | ||||
dwkim |
15434 | 2011-08-27 | |||
소프트웨어 테스팅 업무를 담당할 때 '개발자도 알아야 할 SW 테스팅 실무' 책을 보고 정리한 내용입니다. 책의 끝까지 정리하려 하였으나 포기...
|
|||||
10 | 모델기반 테스트를 통한 S/W 초기 검증 - 임베디드 소프트웨어 | ||||
anymodules |
15535 | 2011-08-26 | |||
모델기반 테스트를 통한 S/W 초기 검증 출처 : 임베디드 소프트웨어 글 윤상호, Senior Application Engineer, MathWorks ·약력: 2001년 자동차 분야 제어 시스템 엔지니어로서 연구원 생활을 시작하였으며, 2006년 MathWorks에 입사하...
|
|||||
9 | 고속 기판 설계, 방어 설계 | ||||
anymodules |
12326 | 2010-07-30 | |||
고속 기판 설계시의 문제점, 방어 설계로 해결한다 특성 임피던스가 고속 기판에서 문제가 될 때가 종종 있다. [방어 설계] 기술을 통해 자동 툴들이 처리해 주지 못하는 이같은 문제를 해결할 수 있다. 고속 기판의 설계에 있어서 ...
|
|||||
8 | MAC Address 할당/구매 | ||||
dwkim |
23955 | 2010-07-27 | |||
이더넷 맥 어드레스는 공짜가 아니다. IEEE 에서 관리하고 있으며 유상으로 제공한다. 몇 가지 선택사항이 있으므로 충분히 숙지한 후에 결제를... MAC Address 할당받는 방법: 1. Organizationally Unique Identifier (OUI) - 총 ...
|
|||||
7 | poll, select | ||||
dwkim |
17250 | 2010-07-21 | |||
poll 구현 ; Application 에서 poll을 구현하려면 먼저 디바이스 드라이버가 poll 을 지원하도록 드라이버 소스에 poll 관련 코드를 추가해야 한다. 특히 poll 함수를 구현하여 내부에 poll_wait() 함수를 리스팅했다면 wake_up_interrup...
|
|||||
6 | RTOS | ||||
dwkim |
13914 | 2010-07-21 | |||
2007 년에 Real Time 구현을 위해 자료를 조사하던 중 기록한 내용임. 퍼왔는지 내가 직접 정리했었는지는 기억 안남. 백업 차원에서 일단 포스팅. RTOS RTOS - 주어진 작업을 정해진 시간 안에 수행할 수 있는 환경을 제공하는 운...
|
|||||
5 | 산업용PC_OS Ghost Image 설치 | ||||
dwkim |
20858 | 2010-07-20 | |||
1. USB 메모리를 DOS 시동 디스크로 만들기 위해 HP USB Disk Storage Format Tool 을 실행한다. 2. DOS 시스템 파일 위치를 지정한다. 첨부 파일의 Booting 폴더를 지정한다. 3. 시작을 눌러 USB 메모리 포맷 & 시동...
|
|||||
4 | OrCAD License Manager 를 다른 PC 에 옮겨 설치할 때 | ||||
dwkim |
19071 | 2010-07-20 | |||
- OrCAD 를 쓰다 보면 부득이하게 라이센스 매니져를 다른 PC에 설치해야 할 때가 있다. 이 때는 프린터포트의 라이센스 동글을 떼어서 새로 서버가 될 PC 에 꽂는 것과 함께 다음의 작업을 좀 해줘야 클라이언트에서 OrCAD가 제...
|
|||||
3 | 자식 다이얼로그 생성 | ||||
dwkim |
66774 | 2010-07-20 | |||
자식 다이얼로그 생성 예) 부모 : CFirstDlg / 자식 : CChildDlg 1. 리소스 뷰에 다이얼로그를 추가 -> 편집한다. (자식 다이얼로그로 디스플레이될 것임.) 2. 추가한 다이얼로그에 클래스를 연결한다. 2-1. 추가한 다이얼로그 창을 더블...
|
|||||
2 | 커패시터 동작온도, 내압, 탄탈 패키지 사이즈 | ||||
dwkim |
20540 | 2010-07-20 | |||
<커패시터 동작온도>
X7R : -55℃~125℃
X5R :
-55℃~85℃
Y5V :
-30℃~85℃
<커패시터 내압>
Z급 :
16V 내압 K급 : 50V
내압
-------------------------------------------------------------------
커패시터의 내압은 보통 사용 전압의
세배 정도...
|
|||||
1 | 칩 저항 Size, 저항 오차 | ||||
dwkim |
28730 | 2010-07-19 | |||
<칩 저항 Size> Inch mm mm mm 1005 0402 0.4 0.2 0201 0603 0.6 0.3 0402 1005 1.0 0.5 0603 1608 1.6 0.8 0805 2012 2.0 1.25 1206 3216 3.2 1.6 1210 3226 3.2 2.6 2010 5025 5.0 2.5 2512 6331 6.3 3.1 <저항 오차> F ...
|