OpenEtherCATsociety / SOEM

Simple Open Source EtherCAT Master
Other
1.35k stars 686 forks source link

Error "Synchronization error" after switching from SAFE to OP state. #842

Closed PhamTuTai closed 2 weeks ago

PhamTuTai commented 3 months ago

Hi everyone. I have been studying SOEM recently. I am currently having problems with synchronizing the time between master and slave. I have looked at previous topics for help with communication. I have now successfully entered SAFE mode. For OMRON driver, when entering SAFE, it is required to enable Syn0 synchronization mode and write 1 to register 0x0300. So I did as requested above. But when switching from SAFE to OP state, an error occurs. I see ec_slave[0].state = EC_STATE_OPERATIONAL but it is not stable. And finally it returns to the previous SAFE state and reports the error "Slave 1 State=0x14 StatusCode=0x001a: Synchronization error". Can anyone help me with this problem? I have attached the simple_test file and wireshark. Thanks.

SOEM (Simple Open EtherCAT Master) Slaveinfo Starting slaveinfo ec_init on enx00e04c781ff1 succeeded. ec_config_init 0 1 slaves found and configured. Slave 1 State= 1 StatusCode= 0 : No error SOEM config IOMap. ec_config_map_group IOmap:0x5e445d37c000 group:0 IOmapSize 40 SOEM config Sync0 for enter Safe-OP. Calculated workcounter 3 Slave:1 Name:R88D-KN01H-ECT
Output size: 96bits Input size: 224bits State: 4 Delay: 0[ns] Has DC: 1 DCParentport:0 Activeports:1.0.0.0 Configured address: 1001 Man: 00000083 ID: 00000005 Rev: 00020001 SM0 A:1800 L: 256 F:00010026 Type:1 SM1 A:1c00 L: 256 F:00010022 Type:2 SM2 A:1100 L: 12 F:00010064 Type:3 SM3 A:1200 L: 28 F:00010022 Type:4 FMMU0 Ls:00000000 Ll: 12 Lsb:0 Leb:7 Ps:1100 Psb:0 Ty:02 Act:01 FMMU1 Ls:0000000c Ll: 28 Lsb:0 Leb:7 Ps:1200 Psb:0 Ty:01 Act:01 FMMUfunc 0:1 1:2 2:0 3:0 MBX length wr: 256 rd: 256 MBX protocols : 04 CoE details: 2f FoE details: 00 EoE details: 00 SoE details: 00 Ebus current: 0[mA] only LRD/LWR:0 PDO mapping according to CoE : SM2 outputs addr b index: sub bitl data_type name [0x0000.0] 0x6040:0x00 0x10 UNSIGNED16 Controlword [0x0002.0] 0x607A:0x00 0x20 INTEGER32 Target position [0x0006.0] 0x60B8:0x00 0x10 UNSIGNED16 Touch probe function [0x0008.0] 0x60FE:0x01 0x20 UNSIGNED32 Physical outputs SM3 inputs addr b index: sub bitl data_type name [0x000C.0] 0x603F:0x00 0x10 UNSIGNED16 Error code [0x000E.0] 0x6041:0x00 0x10 UNSIGNED16 Statusword [0x0010.0] 0x6064:0x00 0x20 INTEGER32 Position actual value [0x0014.0] 0x6077:0x00 0x10 INTEGER16 Torque actual value [0x0016.0] 0x60F4:0x00 0x20 INTEGER32 Following error actual value [0x001A.0] 0x60B9:0x00 0x10 UNSIGNED16 Touch probe status [0x001C.0] 0x60BA:0x00 0x20 INTEGER32 Touch probe pos1 pos value [0x0020.0] 0x60BC:0x00 0x20 INTEGER32 Touch probe pos2 pos value [0x0024.0] 0x60FD:0x00 0x20 UNSIGNED32 Digital inputs End slaveinfo, close socket Slave 1 State= 4 StatusCode= 0 : No error End program

wireshark_log.pcapng.gz simple_test.zip Omron R88D-KNxxx-ECT.zip slaveinfo.zip