33
PC CURS CAN - BUS 1

TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

PCCURS

CAN - BUS

1

Page 2: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

CE ESTE CAN - BUS

2

• CAN - BUS sau Controller Area Network (CAN), este o magistrala seriala care a fost proiectat iniţial pentru industria de automobile, dar a devenit un bus popular in automatizari industriale, precum şi alte aplicaţii.

• Magistrala CAN este utilizata în principal în domeniul sistemelor integrate, şi cum sugerează şi numele, este o reţea stabilită între microcontrolere.

•Este un bus cu două fire, half duplex, de mare viteză şi este foarte potrivit pentru aplicatii de mare viteza prin intermediul unor mesaje scurte.

Page 3: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

ISTORIA CAN - BUS

• CAN a fost dezvoltat pentru prima dată de Robert Bosch GmbH, Germania în 1986, când a fost solicitata pentru a dezvolta un sistem de comunicare între trei ECU (unităţi electronice de control) în vehicule de către Mercedes.

• Ei au descoperit că un UART nu mai este adecvat în această situaţie, deoarece este utilizat în comunicare de la punct-la-punct.

• Nevoia unui sistem de comunicare multi-master a devenit imperativa. Primul cip specializat CAN a fost apoi fabricat în 1987 de către Intel

3

Page 4: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

CE ESTE CAN - BUS

• Câteva dintre beneficiile utilizarii CAN – BUS sunt: robusteţea, fiabilitatea şi suportul industriei.

• CAN poate lega teoretic de până la 2032 dispozitive (presupunând un nod cu un identificator) pe o singură reţea.

• Cu toate acestea, din cauza limitarilor practice ale hardware-ului (transceivere), se pot lega doar până la 110 noduri pe o singură reţea.

• Acesta oferă rata de transfer mare, de până la 1 Mbits/sec,permitand astfel control în timp real.

• Rata de eroare mica şi caracteristica de detectare a erorilor face CAN – BUS un bus de încredere în medii unde zgomotuleste critic.

4

Page 5: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

CAN - BUS

• CAN-Bus este un bus de tip broadcast. Aceasta inseamna ca toate nodurile pot asculta tot ce se transmite pe bus. Nu exista un mod de a transmite mesaje doar unui nod specific fara ca celelalte sa il receptioneze.

• CAN-Bus utilizeaza NRZ (Non-Return To Zero) cu bit-stuffing. Modulele sunt conectate la bus, formand un SI cablat. Rezultaca valoarea 0 logic este dominanta pe bus, iar valoarea 1 logic recesiva.

• Standardul CAN-Bus defineste patru tipuri diferite de mesaje. Acestea utilizeaza o schema simpla si inteligenta pentruarbitrarea accesului la bus.

• Standardul CAN-Bus defineste o schema elaborata pentrucontrolul erorilor.

5

Page 6: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

CAN - BUS

• CAN-Bus utilizeaza o transmisie diferentiala pe o pereche de fire rasucite (twisted pair cable), cu rezistenta de terminatie

• CAN-Bus este multi master

• Rata maxima de transmisie este: 1 Mbit/sec

• Lungimea maxima este 40m la 1Mbit/sec, mergand pana la 10Km la 5Kbits/sec

• CAN-Bus este un bus de incredere

• Latenta maxima pentru un mesaj cu prioritate inalta este 120 µsec la 1Mbit/sec

6

Page 7: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

STANDARDE CAN - BUS

• Specificaţia originală este data in specificatia Bosch. Versiunea 2.0 a specificaţiei este împărţita în două părţi:– Standard CAN (ver 2.0A). Utilizează 11 biţi de identificare

– Extended CAN (ver 2.0B). Utilizează 29 biţi de identificare

• Cele doua parti definesc formate diferite ale cadrului mesajului, principala diferenţă fiind lungimea identificatorului.

• Există mai multe standarde ISO / SAE pentru CAN. Cateva suntdate in tabelul urmator.

7

Page 8: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

STANDARDE CAN - BUS

8

Standard Common Name Baud Rate Max nodes Max Length

Adapter for

PCAN interfaces

ISO 11783 ISOBUS 250 KBit/s 30 40m None

ISO 11898-2 High speed-CAN max. 1 MBit/s 110 6500 m None

ISO 11898-3 Fault Tolerant CAN max. 125 KBit/s 32 500 m PCAN TJA1054

ISO 11992 FMS or

Truck/Trailer CAN max. 125 KBit/s 2 (Point to Point) 40 m PCAN-BD10011S

ISO 15765Diagnostics On

CAN max 1 MBit/s 110

SAE J1939 250 KBit/s 30 40m

SAE J2284 max. 1 MBit/s 110

SAE J2411 Single Wire CAN

33,3 KBit/s

32 PCAN-AU57983,3KBit/s in

HSMode

Page 9: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

STANDARDE CAN - BUS

• Există trei tipuri de controlere CAN:– Tip A,

– Tip B pasiv,

– Tip B.

9

•Cele mai multe controllere 2.0A pot transmite şi primi mesaje numai in format standard•Controllerele 2.0B pasiv, vor primi mesaje in format extins, dar le ignora. •controllorele de 2.0B pot trimite şi primi mesaje în ambele formate. •Dacă 29 de biţi de identificare sunt folositi pe un bus care conţine controller A, busul nu va funcţiona!

Page 10: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

MESAJE CAN - BUS

• CAN Bus utilizeaza mesaje scurte, lungimea maxima fiind de 94 bits.

• Nu exista o adresa explicita in mesaj. In schimb putem spune ca mesajele sunt adresate de continut, sau altfel spus continutulmesajului determina adresa sa.

Tipuri de mesaje

• Sunt patru tipuri diferite de mesaje sau cadre pe un CAN Bus:– Data Frame,

– Remote Frame,

– Error Frame,

– Overload Frame.

10

Page 11: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

DATA FRAME

Sumar: “Hello everyone, here’s some data labeled X, hope you like it!”Data Frame este cel mai comun tip de mesaj. El este in general compus din urmatoareleparti:• Campul de arbitrare, care determina prioritatea mesajului, cand doua sau mai multe

noduri incearca sa acceseze simultan busul. Campul de arbitrare contine: – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date.– Pentru CAN 2.0B, un Identifier de 29-bit care contine si bitii SRR si IDE, si bitul RTR.

• Campul de date, care contine intre 0 si 8 bytes de date.• Campul CRC, care contine o suma de verificare pe 15-bit, utilizata pentru detectia de

erori. • Un slot (interval) Acknowledge; orice controller CAN care a receptionat corect un

mesaj, trimite un Acknowledgement bit la sfarsitul fiecarui mesaj. Transmitatorulverifica prezenta bitului de Acknowledge si retransmite mesajul daca nu a aparutbitul.– Nota 1: Receptionarea unui bit ACK nu inseamna ca mesajul a ajuns la adresa dorita, ci doar ca un

nod a receptionat acest mesaj correct.– Nota 2: Identificatorul din campul de arbitrare nu este necesar sa identifice continutul mesajului,

desi denumirea acestuia sugereaza acest lucru.

11

Page 12: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

DATA FRAME

12

CAN 2.0A (“standard CAN”) Data Frame.

CAN 2.0B (“extended CAN”) Data Frame.

Page 13: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

REMOTE FRAME

Sumar: “Hello everyone, can somebody please produce the data labeled X?”

Remote Frame este la fel ca Data Frame, cu doua diferente importante:– Este marcat explicit ca Remote Frame (RTR bit din Arbitration Field este recesiv), – Nu exista Data Field.

• Scopul unui Remote Frame este de a solicita o transmisie a unui Data Frame corespunzator. Daca, de exemplu, nodul A transmite un Remote Frame cu Arbitration Field setat la 234, atunci nodul B, daca este initializat corespunzator, poate sa raspunda cu un Data Frame cu campul de arbitrare setat tot la 234.

• Remote Frames pot fi utilizate pentru a implementa un tip de cerere – raspunstipica unui management de traffic de bus. In practica Remote Frame este putinutilizat, deoarece nu se poate predictiona comportamentul unui CAN-Bus. Celemai multe controller CAN pot fi programate sau sa raspunda automat unuiRemote Frame sau sa notifice numai controllerul local.

• Atentie: Lungimea datelor trebuie setata in corespondenta cu lungimeamesajului asteptat. Altfel arbitrarea nu va functiona.

13

Page 14: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

REMOTE FRAME

14

CAN 2.0A (“standard CAN”) Remote Frame.

Page 15: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

ERROR FRAME

Sumar: (everyone, aloud) “OH DEAR, LET’S TRY AGAIN”

• Error Frame este un mesaj special care violeaza regulile de formare a cadrului CAN. El este transmis cand un nod detecteaza o greseala si va cauzatuturor celorlalte noduri sa detecteze eroarea, deci si ele vor trimite ERROR Frames. Transmitatorul va incerca sa retrimita mesajul. Desigur ca pentru a nu distruge traficul pe bus, exista o schema de numarare a erorilor.

• Error Frame este alcatuit dintr-un Error Flag, care are 6 bits de aceeiasivaloare, violand regula bit-stuffing, si un delimitator de eroare cu 8 bits recesivi. Delimitatorul de eroare furnizeaza ceva spatiu astfel incat celelaltenoduri de pe bus sa poata transmite propriile Error Flags cand ei detecteazaprimul Error Flag.

15

Page 16: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

OVERLOAD FRAME

Sumar: “I’m a very busy little 82526, could you please wait for a moment?”

• Overload Frame este mentionat numai de complezenta. Este foarte similar cu Error Frame in ceea ce priveste formatul, si este transmis de un nod care devine prea incarcat. Overload Frame nu este utilizat foarte frecvent, controllerele de azi find sufficient de puternice. Singurul controller care maiare implementata aceasta funcie fiind invechitul 82526.

16

Page 17: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

Standard vs. Extended CAN

• Originally, the CAN standard defined the length of the Identifier in the Arbitration Field to eleven (11) bits. Later on, customer demand forced an extension of the standard. The new format is often called Extended CAN and allows no less than twenty-nine (29) bits in the Identifier. To differentiate between the two frame types, a reserved bit in the Control Field was used.

• The standards are formally called• 2.0A, with 11-bit Identifiers only,• 2.0B, extended version with the full 29-bit Identifiers (or the 11-bit, you can mix them.) A 2.0B node can be

– “2.0B active”, i.e. it can transmit and receive extended frames, or– “2.0B passive”, i.e. it will silently discard received extended frames (but see below.)

• 1.x refers to the original specification and its revisions.• New CAN controllers today are usually of the 2.0B type. A 1.x or 2.0A type controller will get very upset if it receives

messages with 29 arbitration bits. A 2.0B passive type controller will tolerate them, acknowledge them if they are correct and then – discard them; a 2.0B active type controller can both transmit and receive them.

• Controllers implementing 2.0B and 2.0A (and 1.x) are compatible – and may be used on the same bus – as long as the controllers implementing 2.0B refrain from sending extended frames!

• Sometimes people advocate that standard CAN is “better” than Extended CAN because there is more overhead in the Extended CAN messages. This is not necessarily true. If you use the Arbitration Field for transmitting data, then Extended CAN may actually have a lower overhead than Standard CAN has.

17

Page 18: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

FUNCTIONARE CAN - BUS

• CAN este o retea multi master.

• Acesta utilizează CSMA / CD + AMP (Carrier Sense Multiple Access / Collision Detection +Arbitration on Message Priority). – Înainte de a trimite un mesaj verifică dacă nodul CAN bus este ocupat.

– CAN utilizeaza detectarea coliziunilor. (similar cu Ethernet). Cu toate acestea, atunci când o reţea Ethernet detectează coliziune ambele noduri opresc transmisia, si apoi aştepta un timp aleator înainte de a încerca să trimită din nou. Acest lucru face reţelele Ethernet foarte sensibile la incarcari mari de bus.

• CAN rezolvă această problemă cu un principiu foarte inteligent de arbitraj.

18

Page 19: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

ARBITRAJ CAN - BUS

• Datele transmise mesaje de la orice nod pe o magistrala CAN nu conţin adresele nodului care transmite, sau a orice nod de destinatie.

• În schimb, conţinutul mesajului este etichetat de către un identificator care este unic în întreaga reţea.

• Toate celelalte noduri din reţea primesc mesajul şi fiecare efectuează un test de acceptare a identificatorului pentru a stabili dacă mesajul şi astfel, conţinutul său, este relevant pentru acel nod particular.

• Dacă mesajul este relevant, datele vor fi prelucrate altfel mesajul este ignorat.

19

Page 20: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

IDENTIFICATORI SI ARBITRARE CAN

• Identificatorul unic determină şi prioritatea mesajului. Cu cat este mai mică valoarea numerică a identificatorului, cu atat are cea mai mare prioritate.

• Acest lucru permite arbitrajul în cazul în care două (sau mai multe) noduri intra în competiţie pentru accesul la bus, în acelaşi timp.

• Mesajul cu prioritate mai mare are garantat accesul la bus, ca sicand ar fi fost singurul mesaj transmis. Mesajele cu prioritatemai mica sunt automat retransmise în următorul ciclu de bus, sau într-un ciclu de bus ulterioar în cazul în care există si alte mesaje cu prioritate mai mare care aşteaptă să fie expediate.

20

Page 21: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

IDENTIFICATORI SI ARBITRARE CAN

• Fiecare mesaj poate are un identificator care este de 11 biţi (specificatie CAN partea A) sau 29 biţi (partea B).

• Acest identificator este parte principala din arbitrajul CAN, si se află la începutul fiecărui mesaj CAN.

• Identificatorul identifică tipul de mesaj dar si prioritatea mesajului.

• Pe un CAN- bus, daca apare o coliziune, bus-ul stareadominanta este “0”.

• Un nod CAN asculta bus-ul intotdeauna inainte de a face o transmisieUn nod CAN care transmite un “1” in campul de arbitrare si citeste un “0”, va sti ca a pierdut arbitrarea de bus.

• Acesta isi va opri transmisia si va da astfel prioritate noduluicare ba castigat arbitrarea, nod care va continua transmisia.

21

Page 22: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

IDENTIFICATORI SI ARBITRARE CAN

• Un nod CAN care transmite un “1” in campul de arbitrare siciteste un “0”, va sti ca a pierdut arbitrarea de bus.

• Acesta isi va opri transmisia si va da astfel prioritate noduluicare ba castigat arbitrarea, nod care va continua transmisia.

• Doua noduri de retea nu au permisiunea de a transmite mesajecu acelasi identificator.

22

Page 23: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

Basic CAN vs. Full CAN

• The terms “Basic CAN” and “Full CAN” originate from the childhood of CAN. Once upon a time there was the Intel 82526 CAN controller which provided a DPRAM-style interface to the programmer. Then came along Philips with the 82C200 which used a FIFO- (queue-) oriented programming model and limited filtering abilities. To distinguish between the two programming models, people for some reason termed the Intel way as “Full CAN” and the Philips way as “Basic CAN”. Today, most CAN controllers allow for both programming models, so there is no reason to use the terms “Full CAN” and “Basic CAN” – in fact, these terms can cause confusion and should be avoided.

• Of course, a “Full CAN” controller can communicate with a “Basic CAN” controller and vice versa. There are no compatibility problems.

23

Page 24: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

• Bus Arbitration And Message Priority• The message arbitration (the process in which two or more CAN controllers agree on who is to use the

bus) is of great importance for the really available bandwidth for data transmission.• Any CAN controller may start a transmission when it has detected an idle bus. This may result in two

or more controllers starting a message (almost) at the same time. The conflict is resolved in the following way. The transmitting nodes monitor the bus while they are sending. If a node detects a dominant level when it is sending a recessive level itself, it will immediately quit the arbitration process and become a receiver instead. The arbitration is performed over the whole Arbitration Field and when that field has been sent, exactly one transmitter is left on the bus. This node continues the transmission as if nothing had happened. The other potential transmitters will try to retransmit their messages when the bus becomes available next time. No time is lost in the arbitration process.

• An important condition for this bit-wise arbitration to succeed is that no two nodes may transmit the same Arbitration Field. There is one exception to this rule: if the message contains no data, then any node may transmit that message.

• Since the bus is wired-and and a Dominant bit is logically 0, it follows that the message with the numerically lowest Arbitration Field will win the arbitration.

• Q: What happens if a node is alone on the bus and tries to transmit?A: The node will, of course, win the arbitration and happily proceeds with the message transmission. But when the time comes for acknowledging… no node will send a dominant bit during the ACK slot, so the transmitter will sense an ACK error, send an error flag, increase its transmit error counter by 8 and start a retransmission. This will happen 16 times; then the transmitter will go error passive. By an special rule in the error confinement algorithm, the transmit error counter is not further increased if the node is error passive and the error is an ACK error. So the node will continue to transmit forever, at least until someone acknowledges the message.

24

Page 25: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

• Message Addressing And Identification

• It is worth noting once again that there is no explicit address in the CAN messages. Each CAN controller will pick up all traffic on the bus, and using a combination of hardware filters and software, determine if the message is “interesting” or not.

• In fact, there is no notion of message addresses in CAN. Instead, the contents of the messages is identified by an identifier which is present somewhere in the message. CAN messages are said to be “contents-addressed”.

• A conventional message address would be used like “Here’s a message for node X”. A contents-addressed message is like “Here’s a message containing data labeled X”. The difference between these two concepts is small but significant.

• The contents of the Arbitration Field is, per the Standard, used to determine the message’s priority on the bus. All CAN controllers will also use the whole (some will use just a part) of the Arbitration Field as a key in the hardware filtration process.

• The Standard does not say that the Arbitration Field must be used as a message identifier. It’s nevertheless a very common usage.

25

Page 26: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

• A Note On The Identifier Values

• We said that 11 (CAN 2.0A) or 29 (CAN 2.0B) bits is available in the Identifier. This is not entirely correct. Due to compability with a certain old CAN controller (guess which?), identifiers must not have the 7 most significant bits set to all ones, so only the identifiers 0..2031 are left for the 11-bit identifiers, and the user of 29-bit identifiers can use 532676608 different values.

• Note that all other CAN controllers accept the “illegal” identifiers, so in a modern CAN system identifiers 2032..2047 can be used without restrictions.

26

Page 27: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

• The CAN Bus

• The CAN bus uses Non-Return To Zero (NRZ) with bit-stuffing. There are two different signalingstates: dominant (logically 0) and recessive (logically 1). These correspond to certain electrical levels which depend on the physical layer used (there are several.) The modules are connected to the bus in a wired-and fashion: if just one node is driving the bus to the dominant state, then the whole bus is in that state regardless of the number of nodes transmitting a recessive state.

27

Page 28: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

• Different Physical Layers• A physical layer defines the electrical levels and signaling scheme on the bus, the cable impedance

and similar things.• There are several different physical layers:• The most common type is the one defined by the CAN standard, part ISO 11898-2, and it’s a two-wire

balanced signaling scheme. It is also sometimes known as “high-speed CAN”.• Another part of the same ISO standard, ISO 11898-3, defines another two-wire balanced signaling

scheme for lower bus speeds. It is fault tolerant, so the signaling can continue even if one bus wire is cut or shorted to ground or Vbat. It is sometimes known as “low-speed CAN”.

• SAE J2411 defines a single-wire (plus ground, of course) physical layer. It’s used chiefly in cars – e.g. GM-LAN.

• Several proprietary physical layers do exist.• Modifications of RS485 was used in the Old Ages when CAN drivers didn’t exist.• Go to Page 6 to view a number of oscilloscope pictures for those interested in the details of a

message.• Different physical layers can not, as a rule, interoperate. Some combinations may work, or seem to

work, under good conditions. For example, using both “high-speed” and “low-speed” transceivers on the same bus can work.. sometimes.

• A great many CAN transceiver chips are manufactured by Philips; alternative vendors include Bosch, Infineon, Siliconix and Unitrode.

• A very common type is the 82C250 transceiver which implements the physical layer defined by ISO 11898. The 82C251 is an improved version.

• A common transceiver for “low-speed CAN” is TJA1054 from Philips.

28

Page 29: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

• Maximum Bus Speed

• The maximum speed of a CAN bus, according to the standard, is 1 Mbit/second. Some CAN controllers will nevertheless handle higher speeds than 1Mbit/s and may be considered for special applications.

• Low-speed CAN (ISO 11898-3, see above) can go up to 125 kbit/s.

• Single-wire CAN can go up to around 50 kbit/s in its standard mode and, using a special high-speed mode used e.g. for ECU programming, up to around 100 kbit/s.Minimum Bus Speed

• Be aware that some bus transceivers will not allow you to go below a certain bit rate. For example, using 82C250 or 82C251 you can go down to 10 kbit/s without problems, but if you use the TJA1050 instead you can’t go below around 50 kbit/s. Check the data sheet.

29

Page 30: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

• Maximum Cable Length• At a speed of 1 Mbit/s, a maximum cable length of about 40 meters (130 ft.) can be used. This is because the

arbitration scheme requires that the wave front of the signal can propagate to the most remote node and back again before the bit is sampled. In other words, the cable length is restricted by the speed of light. A proposal to increase the speed of light has been considered but was turned down because of its inter-galactic consequences.

• Other maximum cable lengths are (these values are approximate) –• 100 meters (330 ft) at 500 kbit/s• 200 meters (650 ft) at 250 kbit/s• 500 meters (1600 ft) at 125 kbit/s• 6 kilometers (20000 ft) at 10 kbit/s• If optocouplers are used to provide galvanic isolation, the maximum bus length is decreased accordingly.

Hint: use fast optocouplers, and look at the delay through the device, not at the specified maximum bit rate.Bus Termination

• An ISO 11898 CAN bus must be terminated. This is done using a resistor of 120 Ohms in each end of the bus. The termination serves two purposes:

• Remove the signal reflections at the end of the bus.• Ensure the bus gets correct DC levels.• An ISO 11898 CAN bus must always be terminated regardless of its speed. I’ll repeat this: an ISO 11898 CAN

bus must always be terminated regardless of its speed. For laboratory work just one terminator might be enough. If your CAN bus works even though you haven’t put any terminators on it, you are just lucky.

• Note that other physical layers, such as “low-speed CAN”, single-wire CAN, and others, may or may not require termination. But your vanilla high-speed ISO 11898 CAN bus will always require at least one terminator.

30

Page 31: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

• The Cable

• The ISO 11898 prescribes that the cable impedance be nominally 120 Ohms, but an impedance in the interval of [108..132] Ohms is permitted.

• There are not many cables in the market today that fulfill this requirement. There is a good chance that the allowed impedance interval will be broadened in the future.

• ISO 11898 is defined for a twisted pair cable, shielded or unshielded. Work is in progress on the single-wire standard SAE J2411.

• CAN connectors

• There is no standard at all for CAN bus connectors! Usually, each Higher Layer Protocol(!) defines one or a few preferred connector types. Common types include

• 9-pin DSUB, proposed by CiA.

• 5-pin Mini-C and/or Micro-C, used by DeviceNet and SDS.

• 6-pin Deutch connector, proposed by CANHUG for mobile hydraulics.

• Go to Page 7 to view a few different connector layouts.

31

Page 33: TCI CURS 2 - electronicaplicata.files.wordpress.com · – Pentru CAN 2.0A, un Identifier de 11-bit si un bit, RTR, care defineste tipul de cadru de date. – Pentru CAN 2.0B, un

33