Ethercat para principiantes

Hace algún tiempo, tuvimos un objeto donde los términos de referencia incluían el requisito: "Protocolo Ethercat". En el proceso de búsqueda de información, subí a Habr y me sorprendió descubrir que no había análisis de este protocolo allí. Y, en general, la información sobre él está bastante fragmentada (mirando hacia el futuro, solo estaba buscando en el lugar equivocado). Hicimos un proyecto, y este artículo es para el "yo más joven", un intento de ahorrar tiempo para alguien más que va a usar o simplemente está interesado en este protocolo.



La única advertencia es que describiré el nivel bastante bajo del protocolo (capa de datos en terminología EtherCAT). Porque era él a quien necesitábamos y nos limitamos a él. Los protocolos de la capa de aplicación como CanOPEN-over-EtherCAT (CoE) permanecerán sin describir (¿por ahora?).





EtherCAT en una oraciĂłn



Es fácil buscarlo en Google, pero en aras del orden, lo diré con mis propias palabras. EtherCAT es un bus de comunicación industrial con un alto rendimiento (100 Mbit / s) y una velocidad de respuesta (unos microsegundos para decenas de dispositivos en una línea, separados por decenas de metros), utilizando Ethernet a bajo nivel, pero al mismo tiempo difiere del concepto Ethernet habitual. responder".



Ethernet — , , . EtherCAT — , ( EtherCAT-) , .



, , . — , . — , , — UDP, EtherCAT . EtherCAT- — , — ARP . EtherCAT-.





"" , . , .



, — Infineon XMC4300\4800 Microchip LAN9252. ( - ), — EtherCAT ( ).

EtherCAT XMC4800 Relax EtherCAT Kit. ? — , ( ) .





.



:





WireShark. , , .



, . -, , , wkc2 APWRw. : EtherCAT_Communication_EN.pdf. — ethercat.org . EtherCAT association. , ( NDA, Beckhoff - ), , .

— , .



,



-, , Ethercat, Ethercat. , Vendor ID. , . https://ethercat.org/en/membership_application.html



VendorID! , VendorID . — "", .. EtherCAT . - , - — .



ethercat



, . — . . ?



4 , 2 (port 0 port 1). :





: , ( ). . 0 ethercat processing unit, , .



, ethercat , port0 , port 0, ethercat processing unit, .. port0 .





:





port0 port1, port0 , .. , (? 0) .



.





? , — Ethercat .



. ""? . — ethernet . . ? , - , : — . — ( ).



, . , , , — "" 1, 0 . — ethercat. , , .



, "4- " "" , , .



, , "". Ethernet — \ . IP ( ARP ), MAC . 4 .



, infineon, microchip 2.





ethercat — Beckhoff 4- ethercat :



https://www.beckhoff.com/ru/default.htm?ethercat/ek1100.htm

https://www.beckhoff.com/ru/default.htm?ethercat/ek1122.htm





, , - ethernet switch. , ( ).



\. Ethercat — broadcast MAC , . — ( ), , , — , .



slave — DPRAM



, slave — , . Infineon , SPI. 4 ( 0x1000) — , ethercat, .



XMC4800 8





( ) , EtherCAT . , .



( XMC), :



  • 0x000 — TYPE = 0x98 ( )
  • 0x010 — STATION_ADR, ( , )
  • 0x040 — RESET_ECAT, .
  • 0x100 — DL_CONTROL, (\)
  • 0x110 — DL_STATUS, ( )

    . .


master'a — ethercat .



. ethercat .

:





, ( TCP UDP, 0x88A4), UDP . UDP ( ethercat ), Ethercat — - UDP .



:





, Working counter (WKC).





Wkc — . , wkc wkc ( wkc ). , , BRD " " wkc .



  • Cmd — . , .
  • Idx — , . . SOEM \.
  • Address — . Cmd — 16- ADP ADO ( ), 32- (Logical Addr).
  • Len — .
  • C, R, M, IRQ — , — . SOEM .


, Cmd. . . BRD BRD.



APxx . ADP " ". ? , 0x0000 .
FPxx . STATION_ADR ADP
Bxx . . , , OR . .. , 0
Lxx . FMMU, 32- , . .


xxRD . ( )
xxWR . ,
xxRW . LRW - , . .
xxRMW . ADP (. ) , . LRW .


SyncManager



EtherCAT ( ) SyncManager.



SyncManager (SM) — ethercat , .

0x800. SM 8 , .. 0x800-0x807 SM1, 0x808-0x80F SM2 . XMC4800 8 SyncManager.



— mailbox . . , .



Mailbox — - ethercat. , .



Buffered — . .



  • Mailbox Read. — ( WKC=0). ( ) — - ( WKC=0). ( ) — ( ), (WKC 1) .
  • Mailbox Write. . , , ( ) WKC=0.


  • Buffered Read. . , . , .. SyncManager 0x1000-0x1010, 0x1000-0x1030. 0x1000-0x1010, , .
  • Buffered Write. , . .. , , .


FMMU



Ethercat, LRW. Fieldbus Memory Management Unit (FMMU). . SyncManager, . , . , , , , StartBit 0, EndBit — 7.



, . FMMU0 0x1000 ( ), 0x12345678+4* , 4 , READ. FMMU0 0x1000 ( ), 0x12345678+400+4* , WRITE. LRW 0x12345678, 800 , . . , , ( slave2slave communication), .



, FMMU , SyncManager .





EtherCAT Beckhoff . EEPROM . AL_STATUS, EEPROM . CanOPEN-over-EtherCAT(CoE) \. Ethernet-over-EtherCAT(EoE) Files-over-EtherCAT (FoE) . ESI- c VendorID . . , , EtherCAT , , .




All Articles