Ethercat para iniciantes

Há algum tempo, tínhamos um objeto cujo termo de referência incluía o requisito: “protocolo Ethercat”. No processo de busca de informações, subi no Habr e fiquei surpreso ao descobrir que não havia nenhuma análise desse protocolo lá. E, em geral, as informações sobre ele são bastante fragmentadas (olhando para frente - só estava olhando no lugar errado). Fizemos um projeto, e este artigo é para o "eu mais jovem", uma tentativa de economizar tempo para alguém que vai usar ou simplesmente está interessado neste protocolo.



A única ressalva é que vou descrever o nível bastante baixo do protocolo (camada de dados na terminologia EtherCAT). Porque era dele que precisávamos e nos limitamos a ele. Os protocolos da camada de aplicação, como CanOPEN-over-EtherCAT (CoE), permanecerão não descritos (por enquanto?).





EtherCAT em uma frase



É fácil pesquisar no Google, mas, por uma questão de ordem, direi com minhas próprias palavras. EtherCAT é um barramento de comunicação industrial com alto rendimento (100 Mbit / s) e velocidade de resposta (alguns microssegundos para dezenas de dispositivos em uma linha, separados por dezenas de metros), usando Ethernet em um nível baixo, mas ao mesmo tempo difere do conceito usual de Ethernet. responda".



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



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





"" , . , .



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

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





.



:



  • Beckhoff, TwinCAT, . — , . — . — , . . , .
  • Open source , https://github.com/OpenEtherCATsociety/SOEM. STM32F207 FreeRTOS . , , . , .


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