{"id":1621,"date":"2012-04-04T02:18:31","date_gmt":"2012-04-03T22:48:31","guid":{"rendered":"http:\/\/fxplans.com\/web\/?page_id=1621"},"modified":"2012-08-31T10:14:16","modified_gmt":"2012-08-31T06:44:16","slug":"controller-are-network","status":"publish","type":"page","link":"http:\/\/fxplans.com\/web\/controller-are-network\/","title":{"rendered":"Controller Are Network"},"content":{"rendered":"<p><span style=\"color: #000080; font-family: georgia, palatino; font-size: large;\">Introduction<\/span><\/p>\n<p>This report describes some of the di\u000berent network protocols used in the automotive\u00a0industry and then discusses similarities and di\u000berences between them.\u00a0The report is divided into three main sections. The \frst describes the Controller Area\u00a0Network (CAN), developed by Robert Bosch. This was identi\fed as the most important\u00a0network system for the project. There are several other protocols being developed for\u00a0use in the industry, however, especially for \\drive by wire&#8221; applications as well as earlier<br \/>\nprotocols which might still be encountered. Some of these other protocols are described in\u00a0the second section. The third section then considers similarities and di\u000berences between\u00a0these protocols from the point of view of the project, so discusses issues of interest for<br \/>\nmodelling and simulating the networks.\u00a0The references consulted are listed in a bibliography. Much of the investigation for this<br \/>\nreport was done using the Web, so many of the sources are actually web-site urls rather\u00a0than published papers. In the nature of the Web it is likely that some of these sources\u00a0will become unavailable, but they have been checked during preparation of this report.<br \/>\nMany of the web sources have been downloaded and saved or printed, so if a reader of this\u00a0report cannot \fnd a desired source, it might be worth getting in touch with the author.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #000080; font-family: georgia, palatino; font-size: large;\">Controller area Network<\/span><\/p>\n<p>This section describes some of the features of the Controller Area Network of interest in\u00a0modelling networks using the protocol and also brie y discusses these features from that\u00a0point of view. It is therefore not a full description, the sources referred to should be<br \/>\nconsulted for further information.\u00a0Controller Area Network (CAN) is a network protocol developed by Robert Bosch<br \/>\nGmbH for vehicle systems, but which is coming into use for linking distributed controllers,\u00a0sensors etc in other \felds. Bosch have published a speci\fcation. The protocol has\u00a0been adopted as a standard by the ISO, reference ISO11898. Any reference herein to the\u00a0spec&#8221; means the Bosch speci\fcation, not the ISO one, which I have not seen (it costs!).\u00a0CAN is a CSMA\/CD protocol (some sources have CSMA\/CR for similar protocols)\u00a0that uses non-return to zero coding with bit stu\u000eng. It supports speeds of up to 1Mb\/s\u00a0so is an SAE class C protocol, suitable for real time control applications. There is a brief\u00a0explanation of the classes of protocols in section.<br \/>\nMessages are not addressed to intended recipients, but the sender&#8217;s identi\fer is included, and this tells the receivers what data it contains so the receiver ignores it if it is\u00a0not interested. Messages&#8217; identi\fers give the priority of the message, so the priority of<br \/>\nmessages is decided at the design stage.<br \/>\nIn \u00a0there are two standards for CAN 2.0, imaginatively called A and B. These\u00a0di\u000ber in message format (see section 2.2), B has an extended message format, with a 29\u00a0bit identi\fer, as opposed to A&#8217;s 11 bit one.\u00a0In basic can (not to be confused with CAN \\A&#8221;) each controller on the network is\u00a0interrupted by every message on the bus. In full CAN, the CAN devices add \fltration of<br \/>\nthe messages, and will only pass messages with speci\fed identi\fers on to its associated\u00a0controller, so a controller is only interrupted by those messages the CAN terminal passes,\u00a0that is those of interest to that controller.\u00a0The notes on CANbus in Automobile Electrical and Electronic Systems draw attention to the di\u000berence between having a local intelligent control module (for example,for all functions located in the driver&#8217;s door) and having the intelligence actually in the\u00a0actuators, so control is distributed, and each actuator (and each sensor) is on the bus\u00a0itself.<\/p>\n<ul>\n<li>Network access, collision detection and resolution<\/li>\n<\/ul>\n<p>Binary zero is represented by a &#8220;dominant&#8221; state in the bus and binary one by a recessive\u00a0state, so a binary zero takes precedence over a one, so lower numbered message\u00a0identifier\u00a0have priority over higher numbered ones.\u00a0CAN is a CSMA\/CD protocol. If the network is idle, any node can send a message.\u00a0If two messages are sent simultaneously, the node that sends a recessive bit, but detects a\u00a0dominant bit stops transmitting, leaving the network free for the higher priority message.\u00a0The higher priority message is not corrupted (so-called non-destructive bitwise arbitration). As this strategy resolves collisions and does not merely detect them (as is the case\u00a0with other CSMA\/CD protocols, such as Ethernet), some sources describe protocols with\u00a0a similar collision strategy as \\CSMA\/CR&#8221;, Carrier Sense Multiple Access\/Collision Resolution. The identi\fer and RTR \felds (see section 2.2) are used for collision arbitration.\u00a0Therefore arbitration breaks down if two nodes can send data (as opposed to remote request) messages with the same identi\fer, as the clash will not be identi\fed until later in\u00a0the message, giving rise to a bit error. Each node must send data messages with a unique\u00a0identifier. This has the side e\u000bect that if, say, all four road wheels had rotation sensors\u00a0(for ABS and traction control) they would each need their own identi\fer, so they would\u00a0have an order of priority. It seems to me not unreasonable to suggest that this could lead\u00a0to con icts in designing the system, which I do not propose to discuss here as it is outside\u00a0the scope of the project.\u00a0This is supposed to guarantee message latency, but surely can only do so for messages\u00a0of high priority? Clearly this guarantees the highest priority message access to the network<br \/>\nonce the current message transmission is complete. The second highest priority message is\u00a0guaranteed access after that, provided the top priority message source doesn&#8217;t broadcast\u00a0continuously, so this is pretty much guaranteed. Surely, however, as one moves down the\u00a0order of priority, eventually one is going to reach a point where a high priority source\u00a0might be ready to transmit again while a low priority source is still waiting, so its latency\u00a0is not guaranteed. Is this one reason why the SAE J2284-500 standard is limited to 16\u00a0nodes? How well this limits message latency will inevitably depend on loading of the bus\u00a0| how heavily used does it get, typically? It seems reasonable to suppose that rotation\u00a0sensors (for wheel rotation, engine revs etc) cannot send data continually, as it takes time\u00a0to \fnd the speed, so in practice this might limit bus load su\u000eciently for latency to be OK.\u00a0I have seen a reference to a paper on Guaranteeing Message Latencies on CAN. I\u00a0have not yet found a copy.<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Message format<\/li>\n<\/ul>\n<p>The format of the message frames is to be found in detail in the Bosch spec \u00a0or in\u00a0less detail in the Omegas web-site \u00a0and the Kvaser web-site [10]. The standard CAN\u00a0\u00a0frame has an 11 bit identi\fer, while an extended CAN \u00a0frame has a 29 bit\u00a0identifier, for compatibility with other protocols used in the US vehicle industry.\u00a0The standard identifier\u00a0format allows for 2032 nodes on the network and the extended\u00a0identifier\u00a0allows more, but as the extra 18 identi\fer bits are needed for compatibility with\u00a0other protocols, their use is restricted. The SAE J2284-500 standard allows for any\u00a0number of nodes between 2 and 16, inclusive, which doesn&#8217;t seem many.\u00a0devices are backward compatible, and can transmit and receive messages in either format.\u00a0The \\RTR&#8221; (transmission request) \feld which is set to 1 if the message is a request for\u00a0information follows the identi\fer. As such a \\remote request&#8221; frame uses the identi\fer of\u00a0the source of the required data, this means that data takes precedence over a request for\u00a0that data, but a request for high priority data takes precedence over lower priority data.\u00a0These remote request frames are apparently rarely used. The identi\fer \feld and RTR \feld\u00a0are used in collision resolution.\u00a0The data \feld can contain from zero to eight bytes, its length being stated by a 4 bit\u00a0DLC \feld that immediately precedes the data \feld.\u00a0The data \feld is followed by a 15 bit cyclic redundancy check (CRC), a delimiter,\u00a0acknowledgement \feld and end of frame and intermission \felds. After these and a set idle\u00a0time (which may be zero) another node can start transmission.<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>\u00a0Error detection<\/li>\n<\/ul>\n<p>There are 5 error detection mechanisms:<br \/>\n1. Cyclic redundancy check. Each message contains a 15 bit CRC code computed by\u00a0sender and checked by receivers, who will ag any errors. More in the spec.<br \/>\n2. Frame check. At certain points in the frame the current value is prede\fned.<br \/>\n3. Acknowledgement Error Check. If the transmitter determines an error has not been<br \/>\nacknowledged, and ACK error is agged.<br \/>\n4. Bit monitoring. A transmitter checks the network and ags a \\bit error&#8221; if the\u00a0value on the bus is not that sent. This does not happen during transmission of the\u00a0identi\fer \feld, of course, as that is used for collision detection.<br \/>\n5. Bit stu\u000eng. After \fve consecutive bits of the same value, a bit of the opposite value\u00a0is added to the frame. This avoids errors arising from poor synchronisation of the\u00a0network nodes, necessary because non return to zero encoding means there is no\u00a0change in network voltage during a succession of bits of similar value.\u00a0If an error is detected, an error frame is sent, aborting the transmission.<br \/>\nError con\fnement (which may be unique to CAN?) provides a mechanism for distinguishing between temporary and permanent errors. Each node has two error counters (for\u00a0transmit and receive) which are incremented when errors are found. It is covered in more\u00a0detail in the spec [19], but brie y each receive error increments its counter by one, and\u00a0each transmit error increments its counter by 8. If either counter goes above 127 the node\u00a0concerned goes into \\error passive&#8221; mode. In this mode it can still transmit and receive\u00a0messages, but is restricted in agging errors. If a device&#8217;s transmit error counter goes\u00a0above 255, the device will go into \\bus o\u000b&#8221; mode and will cease to be active. This condition might need to be modelled in simulating CANbus systems for FMEA. This seems to\u00a0imply that we must allow for the modelling of repeat errors or for modelling the network\u00a0as though the counter(s) had reached a level such that devices were going into &#8220;bus o\u000b&#8221;\u00a0mode. A simpler approach, of course, would be simply to have \\bus o\u000b&#8221; as a failure mode \u00a0of the network terminal. This will allow the FMEA to test any mitigation strategy for\u00a0this failure of the network.\u00a0Error detection is thorough. Omegas&#8217; material suggests that the undetected error\u00a0probability is 10(expo\u00a011)\u00a0. Of course, detected errors will result in loss or delay to messages,\u00a0which e\u000bects might need modelling.<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Bit timing and synchronisation<\/li>\n<\/ul>\n<p>This is covered in the speci\fcation , of course, and there is an introduction to this in\u00a0the Omegas material [16]. Brie y, a bit time consists of four non-overlapping segments,\u00a0Sync-seg, Prop-seg, Phase-seg1 and Phase-seg2. An edge should lie within Sync-seg, while\u00a0Prop-seg is used to compensate for delay times in the network. It is therefore the sum of\u00a0twice the signal propagation time on the bus, the input comparator delay and the output\u00a0driver delay, so is characteristic to the network. Phase-seg1 and Phase-seg2 are used to\u00a0compensate for edge phase errors. They can be lengthened or shortened by resynchron-<br \/>\nisation. The sampling point is the boundary between Phase-seg1 and Phase-seg2. As\u00a0non-return to zero encoding is used, there need not be an edge during Sync-seg, but bit\u00a0stu\u000eng ensures that there will be an edge after \fve edge-free Sync-segs.\u00a0There is a paper on The Con\fguration of the CAN bit timing [8] which describes the\u00a0bit synchronisation algorithm and parameters to be considered in calculating the CAN bit\u00a0time.<\/p>\n<div><\/div>\n<div>\n<ul>\n<li>AN in the ISO\/OSI stack and higher level protocols<\/li>\n<\/ul>\n<p>The scope of the CANbus protocol covers the physical and data link layers of the ISO\/OSI\u00a0model. The speci\fcation \u00a0refers to three levels in the CANbus protocol | physical\u00a0layer, transfer layer and object layer. The physical layer is not de\fned in the Bosch spec,\u00a0but is typically shielded or unshielded twisted pair. Idle state is both lines at +2.5 volts.\u00a0A dominant bit reduces one line, known as CAN L, to zero, while increasing the other line\u00a0(CAN H) to +5 volts while a recessive bit is close to the idle value, with CAN L slightly\u00a0above CAN H, so is &#8220;over written&#8221; by a dominant bit. A standard for the physical layer\u00a0of a 500 KBPS vehicle network is de\fned in SAE J2284-500 .\u00a0The transfer and object layers between them comprise all the services and functions\u00a0of the ISO\/OSI data link layer. These are discussed in the speci\fcation.\u00a0Various higher level protocols might be added to CAN itself. Kvaser \u00a0has some\u00a0material on this, and Omegas \u00a0have some links on their web-site. Of these the Kvaser<br \/>\nsource is perhaps the more useful. I have also seen an article on higher level protocols\u00a0that gives an overview of the most important higher layer protocols, especially those used\u00a0in industrial automation.<br \/>\nThe Can in Automation (CiA) trade organisation \u00a0supports various higher level\u00a0protocols:<br \/>\n\u000f CANopen<br \/>\n\u000f DeviceNet<br \/>\n\u000f CAL (CAN application layer)<br \/>\n\u000f CAN Kingdom<br \/>\n\u000f SDS (Smart Distributed System)CiA is an organisation mainly interested in using CAN for industrial automation so it\u00a0may well be that the protocols listed above are more common in that \feld than in the\u00a0automotive sector.\u00a0In addition to these, Kvaser list J1939 and OSEK. J1939 is an SAE standard for a\u00a0Truck and Bus Control and Communications Network that uses the CAN protocol and\u00a0includes documentation (though not explicit de\fnitions) for each layer in the ISO\/OSI\u00a0stack. There is a brief introduction to J1939 in section 3.5. OSEK is establishing standards\u00a0for interfaces between hardware, network and software in the automotive \feld. There is an\u00a0introduction in appendix A. In addition there is FNOS (Ford Network Operating System)\u00a0that appears to be a Ford alternative to OSEK. There is an introduction in appendix B.\u00a0Both OSEK and FNOS provide higher level protocols for use with CAN, though their\u00a0scope is broader than that. There appears to be a good deal of overlap between OSEK\u00a0and FNOS.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/fxplans.com\/web\/industrial-network-protocols\/\">See others Industrial Protocol<\/a><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction This report describes some of the di\u000berent network protocols used in the automotive\u00a0industry and then discusses similarities and di\u000berences between them.\u00a0The report is divided into three main sections. The \frst describes the Controller Area\u00a0Network (CAN), developed by Robert Bosch. This was identi\fed as the most important\u00a0network system for the project. There are several other &hellip; <\/p>\n<p><a class=\"more-link block-button\" href=\"http:\/\/fxplans.com\/web\/controller-are-network\/\">Continue reading &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"template-twocolumnsleft.php","meta":[],"_links":{"self":[{"href":"http:\/\/fxplans.com\/web\/wp-json\/wp\/v2\/pages\/1621"}],"collection":[{"href":"http:\/\/fxplans.com\/web\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/fxplans.com\/web\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/fxplans.com\/web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/fxplans.com\/web\/wp-json\/wp\/v2\/comments?post=1621"}],"version-history":[{"count":9,"href":"http:\/\/fxplans.com\/web\/wp-json\/wp\/v2\/pages\/1621\/revisions"}],"predecessor-version":[{"id":2308,"href":"http:\/\/fxplans.com\/web\/wp-json\/wp\/v2\/pages\/1621\/revisions\/2308"}],"wp:attachment":[{"href":"http:\/\/fxplans.com\/web\/wp-json\/wp\/v2\/media?parent=1621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}