{"id":1506,"date":"2014-09-11T07:55:13","date_gmt":"2014-09-11T07:55:13","guid":{"rendered":"https:\/\/ibex.tech\/resources\/?p=1506"},"modified":"2022-02-18T15:05:16","modified_gmt":"2022-02-18T15:05:16","slug":"can-bus-general","status":"publish","type":"post","link":"https:\/\/ibex.tech\/resources\/geek-area\/communications\/can-bus\/can-bus-general","title":{"rendered":".CAN Bus General"},"content":{"rendered":"<p>\nCAN bus&nbsp;(&quot;Controller&nbsp;Area Network&quot;)&nbsp;is widely used in the&nbsp;automotive,&nbsp;aerospace, maritime, industrial and medical industries.\n<\/p>\n<h4>\n\u200bBus General<br \/>\n<\/h4>\n<p>\nMicrocontroller CAN Bus Pins (Pre CAN Transceiver)\n<\/p>\n<p style=\"margin-left: 40px;\">\nHigh =&nbsp;recessive bus state (bus not driven),&nbsp;Low =&nbsp;dominant bus state (bus is driven by transceiver)\n<\/p>\n<p>\nMulti Master serial bus.\n<\/p>\n<p>\nTX and RX pins from the bus transceiver:\n<\/p>\n<p style=\"margin-left: 40px;\">\nThe CAN bus TX line (pre transceiver) idles high.\n<\/p>\n<p style=\"margin-left: 40px;\">\nRX should exactly match TX when transmitting and&nbsp;it is analyzed by the CAN&nbsp;peripheral to see if another device on the bus is transmitting (Low) at the same time. &nbsp;If you see RX low when TX isn&#39;t low then you have another device transmitting at the same time or if your TX pulses simply appear longer then you probably don&#39;t have&nbsp;correct bus termination.\n<\/p>\n<p>\nClocking\n<\/p>\n<p style=\"margin-left: 40px;\">\nUses a lossless bit-wise arbitration method of contention resolution which&nbsp;requires all nodes on the CAN network to be synchronized to sample every bit on the CAN network at the same time. This is why some call CAN synchronous, however it is in fact asynchronous&nbsp;as the data is transmitted without a clock signal.\n<\/p>\n<p style=\"margin-left: 40px;\">\nAs well as receivers all needing to always&nbsp;listen&nbsp;to the data on the CAN network, the transmitting node must also to so it can detect if its transmission&nbsp;is colliding with another node.\n<\/p>\n<p style=\"margin-left: 80px;\">\nIf a logical 1 is transmitted by all transmitting nodes at the same time a logical 1 is seen by all of the nodes, including both the transmitting node(s) and receiving node(s).\n<\/p>\n<p style=\"margin-left: 80px;\">\nIf a logical 0 is transmitted by all transmitting node(s) at the same time then a logical 0 is seen by all nodes.\n<\/p>\n<p style=\"margin-left: 80px;\">\nIf a logical 0 is being transmitted by one or more nodes, and a logical 1 is being transmitted by one or more nodes, then a logical 0 is seen by all nodes including the node(s) transmitting the logical 1.\n<\/p>\n<p style=\"margin-left: 80px;\">\nWhen a node transmits a logical 1 but sees a logical 0, it realizes that there is a contention and it quits transmitting. By using this process, any node that transmits a logical 1 when another node transmits a logical 0 &quot;drops out&quot; or loses the arbitration. A node that loses arbitration re-queues its message for later transmission and the CAN frame bit-stream continues without error until only one node is left transmitting. This means that the node that transmits the first 1 loses arbitration. Since the 11 or 29 bit identifier is transmitted by all nodes at the start of a CAN frame, the node with the lowest identifier transmits more zero&#39;s at the start of the frame, and that is therefore the node that wins the arbitration or has the highest priority.\n<\/p>\n<p>\nData Size\n<\/p>\n<p style=\"margin-left: 40px;\">\nData section of frames is up to 8 bytes long.\n<\/p>\n<h4>\nSpeed &amp; Cable Lengths<br \/>\n<\/h4>\n<p>\n25kbps to 1Mbps\n<\/p>\n<p style=\"margin-left: 40px;\">\n50&nbsp;kbps&nbsp;&#8211; max network length 1600m\u200b (max cable length)\n<\/p>\n<p style=\"margin-left: 40px;\">\n100&nbsp;kbps&nbsp;&#8211; max network length 500m\u200b\n<\/p>\n<p style=\"margin-left: 40px;\">\n500 kbps &#8211; max network length 100m\n<\/p>\n<p style=\"margin-left: 40px;\">\n1 Mbps &#8211; max network length 40m\n<\/p>\n<p>\n\u200bMax cable stub length (i.e. connection from a node to the main daisy chained bus): 0.3m\n<\/p>\n<h4>\nConnectors<br \/>\n<\/h4>\n<p>\nConnector types are not officially specified.\n<\/p>\n<p>\nD9 connector is often used:\n<\/p>\n<p style=\"margin-left: 40px;\">\npin 2: CAN-<br \/>\npin 3: GND<br \/>\npin 7: CAN+<br \/>\npin 9: CAN V+ (Power)\n<\/p>\n<h4>\nTermination<br \/>\n<\/h4>\n<p>\n120ohm resistors are used at each end of the bus.\n<\/p>\n<h4>\nMaximum Number Of Nodes On The Bus<br \/>\n<\/h4>\n<p>\nDependant on a few factors such as cable specification, capacitance, speed, drivers, etc.\n<\/p>\n<p>\nElectrically many of the drivers are rated at 120 nodes.\n<\/p>\n<p>\nEngineers experienced with CAN bus often can&#39;t emphasize enough the importance of quality of&nbsp;wiring and connections\/connectors with this have a direct effect on the maximum number of nodes.\n<\/p>\n<h4>\nAddressing<br \/>\n<\/h4>\n<p>\nAll messages on a CAN bus are broadcast with receiving nodes deciding if they want the data. &nbsp;It is quite normal for more than one node to act on data passed over a CAN bus by another node.\n<\/p>\n<p>\nThe data and remote data frames use an identifier:\n<\/p>\n<p style=\"margin-left: 40px;\">\nA&nbsp;standard frame has an 11 bit identifier&nbsp;in the arbitration field that allows up to 2048 unique messages on&nbsp;the BUS\n<\/p>\n<p style=\"margin-left: 40px;\">\nAn&nbsp;extended frame has a 29 bit identifier that allows up over 536 million unique messages on&nbsp;the BUS\n<\/p>\n<p>\nIf there are no errors with a message sent&nbsp;by a node&nbsp;all other&nbsp;nodes will &ldquo;ack&rdquo; the message by transmitting a dominant bit value onto the BUS while the Transmitting Node is listening. &nbsp;This notifies the transmitter that at least one receiver validates the message.\n<\/p>\n<h4>\nArbitration<br \/>\n<\/h4>\n<p>\nCAN data transmission uses a lossless bit-wise arbitration method. There are &quot;dominant&quot; bits (logical 0 &#8211; actively driven to a voltage by the transmitter) and &quot;recessive&quot; bits (logical 1 &#8211; passively returned to a voltage by a resistor). The idle state is the recessive level (Logical 1). If one node transmits a dominant bit and another node transmits a recessive bit then there is a collision and the dominant bit &quot;wins&quot;. There is no delay to the higher-priority message, and the node transmitting the lower priority message backs off and will automatically attempts to re-transmit six bit clocks after the end of the dominant message. This makes CAN very suitable as a real time prioritized communications system.\n<\/p>\n<p>\nFor example, consider an 11-bit ID CAN network, with two nodes with IDs of 15 (binary representation, 00000001111) and 16 (binary representation, 00000010000). If these two nodes transmit at the same time, when the 8th bit is transmitted the node with the ID of 15 transmits a 0 (dominant) for its ID. When this happens, the node with the ID of 16 knows it transmitted a 1, but sees a 0 and realizes that there is a collision and it lost arbitration. Node 16 stops transmitting which allows the node with ID of 15 to continue its transmission without any loss of data. The node with the lowest ID will always win the arbitration, and therefore has the highest priority.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CAN bus&nbsp;(&quot;Controller&nbsp;Area Network&quot;)&nbsp;is widely used in the&nbsp;automotive,&nbsp;aerospace, maritime, industrial and medical industries. \u200bBus General Microcontroller CAN Bus Pins (Pre CAN Transceiver) High =&nbsp;recessive bus state (bus not driven),&nbsp;Low =&nbsp;dominant bus state (bus is driven by transceiver) Multi Master serial bus. TX and RX pins from the bus transceiver: The CAN bus TX line (pre transceiver) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94],"tags":[],"class_list":["post-1506","post","type-post","status-publish","format-standard","hentry","category-can-bus"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts\/1506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/comments?post=1506"}],"version-history":[{"count":16,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts\/1506\/revisions"}],"predecessor-version":[{"id":1852,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts\/1506\/revisions\/1852"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/media?parent=1506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/categories?post=1506"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/tags?post=1506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}