낮은 번호가 우성 id를 가지기에 더 우선권을 가지고, 높은 번호가 통신을 id 만 보고 포기하게 만드는 구조.
11비트: 차량 내부 제어 네트워크(파워트레인, 섀시), CANopen, OBD-II 요청(0x7DF) 29비트: SAE J1939(상용차), NMEA 2000(선박), ISO 11783(농기계). ID 안에 PGN, 우선순위, 소스 주소를 필드로 나눠 넣는 구조라 29비트가 필요합니다
AMP가 하는 일
이더넷의 CSMA/CD는 충돌이 나면 양쪽 다 전송을 포기하고 랜덤한 시간만큼 기다렸다가 재시도합니다. 보내던 프레임은 버려지고, 언제 성공할지 예측할 수 없습니다.
AMP는 다릅니다. 충돌이 나도 우선순위가 높은 프레임 하나는 중단 없이 계속 전송됩니다. 진 쪽만 조용히 물러나므로 버스 시간이 전혀 낭비되지 않습니다. 이걸 비파괴적 비트 단위 중재(non-destructive bitwise arbitration)라고 부릅니다.
작동 원리는 두 가지 성질에 기대고 있습니다.
버스가 wired-AND로 동작한다. 우성(0)이 열성(1)을 항상 덮어씁니다. 한 노드라도 0을 내보내면 버스 전체가 0이 됩니다. 모든 노드가 자기가 쓴 비트를 되읽는다. 중재 필드(식별자 + RTR)를 MSB부터 한 비트씩 내보내면서 매 비트마다 비교합니다.
진 노드들은 프레임을 버리지 않고 송신 버퍼에 그대로 들고 있다가, 버스가 다시 유휴 상태가 되면 자동으로 재시도합니다.
AMP가 만들어내는 결과
결정론적 지연이 보장됩니다. 우선순위가 가장 높은 메시지는 최악의 경우에도 "현재 전송 중인 프레임이 끝날 때까지"만 기다리면 됩니다. 실시간 제어에서 CAN이 오래 살아남은 이유입니다.
비트레이트와 버스 길이가 묶입니다. 중재가 성립하려면 한 비트 시간 안에 신호가 버스 끝까지 갔다가 돌아와 모든 노드가 같은 값을 봐야 합니다. 그래서 1Mbps면 약 40m, 125kbps면 500m 식으로 속도를 낮춰야 거리가 늘어납니다. 비트 타이밍에서 샘플 포인트를 비트 후반(보통 75~87.5%)에 두는 것도 이 때문입니다.
같은 ID를 두 노드가 쓰면 안 됩니다. ID가 동일하면 중재가 승자를 가리지 못하고 둘 다 끝까지 송신하는데, 데이터 내용이 다르면 그 지점에서 비트 에러가 터집니다. ID는 시스템 전체에서 유일해야 합니다.
우선순위 기아(starvation)가 생길 수 있습니다. 버스 부하가 높으면 낮은 우선순위 메시지가 계속 밀립니다. 그래서 실제 설계에서는 ID를 아무렇게나 배정하지 않고, 주기와 마감시간을 고려한 응답시간 분석(worst-case response time analysis)을 거쳐 우선순위를 정합니다.
참고로 CAN FD도 중재 구간만큼은 AMP를 그대로 씁니다. 고속 전환은 중재가 끝난 뒤 데이터 필드에서만 일어나기 때문에, 이 원리는 최신 CAN에서도 유효합니다.
TheCommon Industrial Protocol(CIP) is an industrial protocol forindustrial automationapplications. It is supported byODVA. Previously known as Control and Information Protocol,[1]CIP encompasses a comprehensive suite of messages and services for the collection of manufacturing automation applications – control, safety, synchronization, motion, configuration and information. It allows users to integrate these manufacturing applications with enterprise-levelEthernetnetworks and theInternet. It is supported by hundreds of vendors around the world,[2]and is media-independent. CIP provides a unified communication architecture throughout the manufacturing enterprise. It is used inEtherNet/IP,DeviceNet, CompoNet andControlNet. ODVA is the organization that supports network technologies built on the Common Industrial Protocol (CIP). These also currently include application extensions to CIP: CIP Safety, CIP Motion and CIP Sync.
DeviceNetis a network protocol used in the automation industry to interconnect control devices for data exchange. It utilizes theCommon Industrial Protocolover aController Area Networkmedia layer and defines an application layer to cover a range of device profiles. Typical applications include information exchange, safety devices, and largeI/O controlnetworks.[1]
Usage: candump [options] <CAN interface>+ (use CTRL-C to terminate candump)
Options: -t <type> (timestamp: (a)bsolute/(d)elta/(z)ero/(A)bsolute w date) -H (read hardware timestamps instead of system timestamps) -c (increment color mode level) -i (binary output - may exceed 80 chars/line) -a (enable additional ASCII output) -S (swap byte order in printed CAN data[] - marked with '`' ) -s <level> (silent mode - 0: off (default) 1: animation 2: silent) -l (log CAN-frames into file. Sets '-s 2' by default) -L (use log file format on stdout) -n <count> (terminate after reception of <count> CAN frames) -r <size> (set socket receive buffer to <size>) -D (Don't exit if a "detected" can device goes down. -d (monitor dropped CAN frames) -e (dump CAN error frames in human-readable format) -x (print extra message infos, rx/tx brs esi) -T <msecs> (terminate after <msecs> without any reception)
Up to 16 CAN interfaces with optional filter sets can be specified on the commandline in the form: <ifname>[,filter]*
Filters: Comma separated filters can be specified for each given CAN interface: <can_id>:<can_mask> (matches when <received_can_id> & mask == can_id & mask) <can_id>~<can_mask> (matches when <received_can_id> & mask != can_id & mask) #<error_mask> (set error frame filter, see include/linux/can/error.h) [j|J] (join the given CAN filters - logical AND semantic)
CAN IDs, masks and data content are given and expected in hexadecimal values. When the can_id is 8 digits long the CAN_EFF_FLAG is set for 29 bit EFF format. Without any given filter all data frames are received ('0:0' default filter).
Use interface name 'any' to receive from all CAN interfaces.
candump -l any,0~0,#FFFFFFFF (log only error frames but no(!) data frames) candump -l any,0:0,#FFFFFFFF (log error frames and also all data frames) candump vcan2,12345678:DFFFFFFF (match only for extended CAN ID 12345678) candump vcan2,123:7FF (matches CAN ID 123 - including EFF and RTR frames) candump vcan2,123:C00007FF (matches CAN ID 123 - only SFF and non-RTR frames)
$ cansend vcan0 cansend - send CAN-frames via CAN_RAW sockets.
Usage: cansend <device> <can_frame>.
<can_frame>: <can_id>#{data} for 'classic' CAN 2.0 data frames <can_id>#R{len} for 'classic' CAN 2.0 data frames <can_id>##<flags>{data} for CAN FD frames
<can_id>: 3 (SFF) or 8 (EFF) hex chars {data}: 0..8 (0..64 CAN FD) ASCII hex-values (optionally separated by '.') {len}: an optional 0..8 value as RTR frames can contain a valid dlc field <flags>: a single ASCII Hex value (0 .. F) which defines canfd_frame.flags