9.       Message Types


 OSI7 구조를 아시나요?   트랜스포트 층의 세그먼트 네트워크 층에서는 데이터’  된다. 라는 개념이 CAN처럼 하위 2계층만 쓰는 프로토콜에선 메세지로 불리게 됩니다. 아래는 메세지의 타입입니다.


1)       Data Frame

이전에 이미 언급한 부분이라서 넘어갑니다.


2)       Remote Frame

- Receiver transmitter data 요청할 출력하는 frame

- Arbitration field에는 transmitter ID 포함되며 data field 없는 것이 특징


3)       Error Frame

- Error 상황을 알리기 위한 frame

- Error 감지한 node 6 dominant bit 출력하면 다른 node 이에 반응 (stuff error)하여 6 dominant 

bit 출력

- 6~12 dominant bits (Error Flag) + 8 recessive bits (Error delimiter) 구성

- Superposition(중첩) : Node들이 출력하는 error flag 순서에 따라서 중첩될 있음

- Error Delimiter : Error frame 종료. 8 recessive bit 구성

 

4)       Overload Frame

   - 다음의 상황에서 overload frame 전송 (bus 상태를 안정화하기 위해서)


(1) Receiver 내부 조건에 의해서 다음 data/remote frame 사이에 delay 필요한 경우

(2) Frame 사이의 intermission 1,2 bit dominant bit 경우

(3) Error delimiter 또는 overload delimiter 마지막 bit dominant bit 경우

- 6 dominant bits (Overload Flag) + 8 recessive bits (Overload delimiter) 구성



'Nobody tells you about.. > CAN Bus' 카테고리의 다른 글

CAN통신의 기초-4  (1) 2013.04.24
CAN통신의 기초-3  (0) 2013.04.23
CAN통신의 기초-2  (0) 2013.04.18
CAN통신의 기초-1  (2) 2013.04.16

1.       Data Link Layer

 

앞서 CAN 통신은 통신 프로토콜인 ISO 11898을 따르며, 이는 네트워크상의 디바이스들 간에 정보가 어떻게 교류될 수 있는지를 기술하며, 계층(Layer) 관점에서 정의된 OSI(Open Systems Interconnection) 모델을 따릅니다. 구체적으로 말한다면, 주로 물리적 계층에서 만든 0,1의 두가지 신호를 실질적으로 데이터로 만드는 encoding, 인코딩해서 만들어진 데이터를 가지고 프레임을 형성하는 framing, 오류발생을 막기위한 error detection, 각 포인트와 포인트간에 속도차를 극복하기 위해서 흐름을 제어하는 flow control등의 역할을 수행합니다.


표준 CAN과 확장 CAN

CAN 통신 프로토콜은 CSMA/CD+AMP(Carrier-Sense Multiple-Access protocol with Collision Detection and Arbitration on Message Priority) 방식이다. CSMA는 버스의 각 노드가 메시지 전송을 시도하기 전, 비활성의 규정 기간을 기다려야 한다. CD+AMP는 충돌이 메시지 식별 필드에서 프로그램된 각 메시지의 우선 순위에 기반해 비트 와이즈 중재(Bit-wise Arbitration)를 통해 해결된다는 것을 의미한다. 더 높은 우선순위의 식별자가 항상 버스에 액세스 된다.

1에 나타난 표준 CAN의 최초 버전, ISO 11519(저속 CAN)는 표준 11비트 식별자를 갖춘 최고 125kbps의 애플리케이션을 위한 것이다. 2차 버전, ISO 11898(1993) 역시 11비트 식별자를 이용해 125kbps에서 1Mbps까지 신호 속도를 제공한다. 가장 최근의 ISO 11898 개정 버전(1995)은 확장 29비트 식별자를 도입했다. ISO 11898 11비트 버전은 표준 CAN 버전 2.0A으로도 종종 불리며, ISO 11898 개정 버전은 확장 CAN 버전 2.0B로 불린다. 그림 2에서 표준 CAN 11비트 식별자 필드는 211 , 2048개의 다른 메시지 식별자를 제공하면서, 그림 3에서 확장 CAN 29비트 식별자는 229 5 3,700만 개의 식별자를 제공한다.

 

▶ 통신 방법의 개요

1) 각각의 Message는 자신의 고유 ID를 갖는다 (ID의 크기 : CAN 2.0A = 11bit, CAN 2.0B = 29bit  - 확장형 )

2) 모든 node bus idle 상태에서 데이터 전송가능 (multi master)

3) Message 충돌의 중재 ID를 통하여 우선 순위 결정

4) 수신 node message ID check 하여 무시 또는 저장

5) 수신 node message 수신 후 acknowledge 신호를 발생

6) Message format error를 판단하면 bus error 신호를 발생

 

Message frame의 구성

1) Frame: 하나의 message를 이루는 field 또는 bit들의 집합

2) Data frame : 일반적으로 전송되는 데이터 message

3) Remote frame : 특정한 ID data frame 전송을 요청

4) Error frame : Error를 판단한 node가 전송하는 message

5) Overload frame : Data frame 사이에 delay가 필요한 경우 전송하는 frame

 

[아래의 그림은 Data frame 나타냅니다] :: CAN 2.0A

 


* SOF- 단일 도미넌트(dominant) SOF(start of frame) 주요한 (logic 0) 비트로 메시지의 시작을 표시합니다.

또한 무부하 기간 이후 버스의 노드를 동기화하기 위해 사용된다.
*
식별자(Identifier) - 메시지를 식별하고 메시지의 우선 순위를 지정합니다. 프레임에는 11 비트 중재 ID를 사용하는 표준 및 29 비트 중재

ID를 사용하는 확장의 두 가지 포맷이 있습니다. 2진 값이 더욱 낮을수록 우선순위는 더욱 높아진다.
* RTR -
단일 원격 전송 요청(RTR: remote transmission request) 비트는 리모트 프레임과 데이터 프레임을 구별하는 역할을 합니다.

주요한 (logic 0) RTR 비트는 데이터 프레임을 나타냅니다. 열성 (logic 1) RTR 비트는 리모트 프레임을 나타냅니다.

* IDE- 도미넌트 싱글 IDE(identifier extension) 표준과 확장 프레임을 구분합니다

* r0- 역 비트 (추후 표준 개정으로 사용 가능)
*
DLC- 4비트 DLC(data length code)는 데이터 필드의 바이트의 수를 나타냅니다

(IDE ~ R0 , DLC Control field (6bits) 를 의미한다)

* 데이터 - 애플리케이션 데이터의 최고 64비트가 전송될 수 있다.
* CRC- 16
비트(15비트+구획문자)의 순환 중복 확인 CRC(cyclic redundancy check)

15 비트의 주기적인 중복 체크 코드 + 리세시브 delimiter 비트로 구성됩니다. CRC 필드는 오류 검출에 사용됩니다.
* ACK-
메시지를 정확하게 수신한 모든 CAN 컨트롤러는 메시지의 말미에 ACK 비트를 전송합니다. 전송 노드는 버스 상에 ACK 비트 유무를 확인하고, ACK가 발견되지 않을 경우 전송을 재시도합니다. NI Series 2 CAN 인터페이스에는 수신 전용 모드 기능이 있습니다. 이 때문에, 모니터링 하드웨어에 의한 ACK 비트의 전송이 금지되어 버스의 작동에 영향을 주지 않게 됩니다. ACK 2비트이며 이 중 1비트는 승인 비트, 2번째 비트는 구획문자이다.
* EOF-
프레임 종료 (EOF) 7비트 필드는 CAN 프레임(메시지)의 종료를 나타내고, 비트 스터핑(bit-stuffing)을 억제시키며, 도미넌트 일 때

스터핑 오류를 가리킨다. 동일한 로직 레벨의 5비트가 정상 동작기간 동안 연속적으로 발생할 때, 반대 로직 레벨의 비트는 데이터로

스터프 된다.
* IFS- 7
비트의 IFS(inter-frame space)는 컨트롤러가 요구하는 시간의 양을 포함하며, 메시지 버퍼 영역에서 적절한 위치로 정확하게 수신된

프레임을 이동시킨다.






확장 CAN (Data frame) :: CAN 2.0B

 

그림 3에서처럼, 확장 CAN 메시지는 다음과 같은 내용이 추가되어 표준 메시지로 동일하다.

* SRR-SRR(substitute remote request) 비트는 표준 메시지 위치에서 RTR 비트를 대신해 확장 포맷에서 플레이스홀더(placeholder)가 된다.

* IDE-IDE(identifier extension)에서 리세시브 비트는 따라야 할 더욱 많은 식별자 비트가 있다는 것을 나타낸다. 18비트 확장은 IDE를 따른다.

* r1-RTR r0 비트를 따르는 추가적인 리세시브 비트는 DLC 비트에 앞서 포함된다.



'Nobody tells you about.. > CAN Bus' 카테고리의 다른 글

CAN통신의 기초-5  (0) 2013.04.25
CAN통신의 기초-4  (1) 2013.04.24
CAN통신의 기초-2  (0) 2013.04.18
CAN통신의 기초-1  (2) 2013.04.16

This study is the report based on TI corporation " Introduction to the Controller Area Network (CAN) "


Introduction to the Controller Area Network (CAN).pdf




ABSTRACT

A controller area network (CAN) is ideally suited to the many high-level industrial protocols embracing CAN and ISO-11898:2003 as their physical layer. Its cost, performance, and upgradeability provide for tremendous flexibility in system design.

This application report presents an introduction to the CAN fundamentals, operating principles, and the implementation of a basic CAN bus with TI's CAN transceivers and DSPs. The electrical layer requirements of a CAN bus are discussed along with the importance of the different features of a TI CAN transceiver.



CAN bus (for controller area network) is a vehicle bus standard designed to allow microcontrollers and devices to communicate with each other within a vehicle without a host computer.

CAN bus is a message-based protocol, designed specifically for automotive applications but now also used in other areas such as aerospace, industrial automation and medical equipment. - Wiki


1 Introduction

 

The CAN bus was developed by BOSCH(1) as a multi-master, message broadcast system that specifies a maximum signaling rate of 1 megabit per second (bps). Unlike a traditional network such as USB or Ethernet, CAN does not send large blocks of data point-to-point from node A to node B under the supervision of a central bus master. In a CAN network, many short messages like temperature or RPM are broadcast to the entire network, which provides for data consistency in every node of the system. Once CAN basics such as message format, message identifiers, and bit-wise arbitration -- a major benefit of the CAN signaling scheme are explained, a CAN bus implementation is examined, typical waveforms presented, and transceiver features examined.


1986 자동차 내의 서로 다른 개의 전자장치 (ECU-Electronic Control Unit) 간의 통신을 위한 통신 장치 개발을 자동차 업체인 벤츠의 요구에 의하여 자동차 부품 업체인 독일의 보쉬에 의해 최초로 개발되었다.

초기에는 UART 방식을 고려하였으나 일대일 (Point To Point) 통신 방식이기에 서로 다른 개의 ECU 간의 통신 방식으로는 적합하지 않아 다중통신 (Multi Master Communication) 방식이 필요하게 되어 CAN 탄생. 그후 최초의 집적화된 CAN 부품은 1987 인텔에 의해 생산되어졌다.

 




2 The CAN Standard


CAN is an International Standardization Organization (ISO) defined serial communications bus originally developed for the automotive industry to replace the complex wiring harness with a two-wire bus. The specification calls for high immunity to electrical interference and the ability to self-diagnose and repair data errors. These features have led to CAN’s popularity in a variety of industries including building automation, medical, and manufacturing.

The CAN communications protocol, ISO-11898: 2003, describes how information is passed between devices on a network and conforms to the Open Systems Interconnection (OSI) model that is defined in terms of layers. Actual communication between devices connected by the physical medium is defined by the physical layer of the model. The ISO 11898 architecture defines the lowest two layers of the seven layer OSI/ISO model as the data-link layer and physical layer in Figure 1.



CAN Version 변천

- ver 1.0 : 1985 - ver 1.1 : 1987 - ver 1.2 : 1990 - ver 2.0 A&B : 1991

ver1.0, 1.1, 1.2 안정화 보편적인 전자 부품의 사용을 가능케 하기 위해 변한 것이며 ver2.0부터는 A B 구분되어져 A 기존과 동일하지만, B 확장 ID 추가함으로 보다 많은 종류 (최대2036->500만개) 데이터를 사용할 있게 하였다

 

CAN이용 반도체 제조사들

- Cygnal : 8051 계열의 Controller

- Fujitsu : Microcontroller

- Hynix : ARM720T Core Processor

- Infineon : Stand-alone controller, Microcontrollers, Transceiver

- Intel : Stand-alone controller, Microcontrollers

- Philips : Stand-alone controller, Microcontrollers, Transceiver

- 기타 취급하는 반도체 회사:

Atmel, Bosch, CiA, Dallas, Hitachi, Inicore, Microchips, Mishibishi, Motorola, NEC, NI, STM, TI 등이 있음

 

 

CAN 장점 특징

 

- CAN 프로토콜은 Multi Master 통신을 한다. 통신버스를 공유하고 있는 CAN컨트롤러들은 모두가 Master역할을 하여 언제든지

버스를 사용하고 싶을 사용할 있다.

- 노이즈에 매우 강하다. 레벨은 다르지만 RS485 비슷하게 twist pair 2선을 사용하여 전기적 Differential 통신을 하여 전기적

노이즈에 매우 강하다

- 표준 프로토콜이므로 시장성이 뛰어나다. 이로 인해 많은 업체들이 경쟁적으로 CAN칩을 제작하고 있으며, 비용 또한 비교

저렴하다. CAN 프로토콜은 호스트 CPU 내장된 CAN 컨트롤러 칩이나, 호스트 CPU 장착된 CAN 주변장치에서 실행

된다.

- 통신속도가 빠르다. -최대 1 Mbps까지 사용할 있다.

- 거리를 통신할 있다. -최대 1000 m 까지도 40 kbps 통신할 있다. 하드웨어적인 오류보정이 있다.

- 하드웨어적으로 설정된 ID만을 골라 수신 받을 있다. CAN에는 수신필터가 있어 필터를 어떻게 설정하느냐에 따라 정해

ID, 특정 그룹 또는 전체 수신을 있다.

- 실시간 메시지 통신을 있다. 한번에 8개의 데이터를 전송하는 HW 패킷을 제공한다. 보통 RS232/RS485

통신에서는 패킷 통신을 위해 사용자가 일일이 패킷 형식을 만들어 주고 수신 받을 때도 그런 해석이 필요하지만 CAN 8바이트 데이터를 담는 HW 패킷 통신을 기본으로 한다. 따라서 사용자는 데이터 버퍼에 데이터를 쓰고 전송만 하면 모든 처리는 HW 알아서 한다. 분산제어 분야 적용이 용이하다.

- 우선순위가 있다.

-사용되는 전선의 양을 획기적으로 줄일 있다.

- PLUG & PLAY 제공한다.

 

[본문중]  CAN ISO 정의한 complex wiring 간단한 a two-wire bus 타입으로 바꾸었다.

CAN 통신은 ISO 11898 통신방식을 채택하고 있다. , The CAN communications protocol, ISO-11898: 2003 네트워크상의 디바이스들 간에 정보가 어떻게 교류될 수 있는지를 설명하고, 계층으로 나눠져 설명하는 OSI모델을 따른다.

Actual communication between devices connected by the physical medium is defined by the physical layer of the model.

The ISO 11898 architecture defines the lowest two layers of the seven layer OSI/ISO model as the data-link layer and physical layer in Figure 1.

ISO-11898 Figure1처럼 데이터 링크와 물리계층 낮은 계층으로 정의됩니다.





In Figure 1, the application layer establishes the communication link to an upper-level application specific protocol such as the endor-independent CANopen™ protocol. This protocol is supported by the international users and manufacturers group, CAN in Automation (CiA). Additional CAN information is located at the CiA Web site, can-cia.de. Many protocols are dedicated to particular applications like industrial automation, diesel engines, or aviation. Other examples of industry-standard, CAN-based protocols are KVASER's CAN Kingdom and Rockwell Automation's DeviceNet™.

 

그림 1에서 애플리케이션 계층은 데이터 링크 레이어 위에 있습니다. 어플리케이션 계층에서 사용되는 예는 CAN open™ protocol 등이 있습니다. CAN 대한 자세한 내용은 cia사이트나 아래를 참조해주세요.

 

CANopen is a communication protocol and device profile specification for embedded systems used in automation. In terms of the OSI model, CANopen implements the layers above and including the network layer. The CANopen standard consists of an addressing scheme, several small communication protocols and an application layer defined by a device profile. The communication protocols have support for network management, device monitoring and communication between nodes, including a simple transport layer for message segmentation/desegmentation. The lower level protocol implementing the data link and physical layers is usually Controller Area Network (CAN), although devices using some other means of communication (such as Ethernet Powerlink, EtherCAT) can also implement the CANopen device profile.  -wiki



'Nobody tells you about.. > CAN Bus' 카테고리의 다른 글

CAN통신의 기초-5  (0) 2013.04.25
CAN통신의 기초-4  (1) 2013.04.24
CAN통신의 기초-3  (0) 2013.04.23
CAN통신의 기초-2  (0) 2013.04.18

+ Recent posts