OpenEtherCATsociety / SOEM

Simple Open Source EtherCAT Master
Other
1.3k stars 668 forks source link

Can not enter SafeOP status #544

Closed gvcode1 closed 2 years ago

gvcode1 commented 3 years ago

Hi, I am using LAN9252 board with Servo drive firmware, but I failed to switch to SafeOP status, it is very strange that I can not switch to SAFEOP state, as current slave can not even enter SafeOP state, so I think it is not DC problem, here is the slaveinfo, is that any problem about this slave? I also test some other drive, they are works fine, but for my STM32+LAN9252 board, it is not possible to enter SAFEOP.

Slave:1 Name:LAN9252-EVB-HBI Output size: 88bits Input size: 88bits State: 2 Delay: 0[ns] Has DC: 1 DCParentport:0 Activeports:1.0.0.0 Configured address: 1001 Man: 00000009 ID: 00009252 Rev: 00000001 SM0 A:1000 L: 128 F:00010026 Type:1 SM1 A:1080 L: 128 F:00010022 Type:2 SM2 A:1100 L: 11 F:00010064 Type:3 SM3 A:1400 L: 11 F:00010020 Type:4 FMMU0 Ls:00000000 Ll: 11 Lsb:0 Leb:7 Ps:1100 Psb:0 Ty:02 Act:01 FMMU1 Ls:0000000b Ll: 11 Lsb:0 Leb:7 Ps:1400 Psb:0 Ty:01 Act:01 FMMUfunc 0:1 1:2 2:3 3:0 MBX length wr: 128 rd: 128 MBX protocols : 04 CoE details: 23 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 Control Word [0x0002.0] 0x607A:0x00 0x20 INTEGER32 Target Position [0x0006.0] 0x60FF:0x00 0x20 INTEGER32 Target Velocity [0x000A.0] 0x6060:0x00 0x08 INTEGER8 Modes of Operation [0x000B.0] 0x0000:0x00 0x08 SM3 inputs addr b index: sub bitl data_type name [0x000B.0] 0x6041:0x00 0x10 UNSIGNED16 Status Word [0x000D.0] 0x6064:0x00 0x20 INTEGER32 Position Actual Value [0x0011.0] 0x606C:0x00 0x20 INTEGER32 Velocity Actual Value [0x0015.0] 0x6061:0x00 0x08 INTEGER8 Modes of Operation Display [0x0016.0] 0x0000:0x00 0x08

here is the eni and captured wireshark package: error_1lan9252_drive.zip

ArthurKetels commented 3 years ago

There are a number of problems.

  1. The data from Eeprom and the data from ENI do not correspond. SM1/2/3 addresses are wrong.
  2. The CoE response of the slave of object 0x1600 and 0x1a00 are one entry short (the 8 bit padding of object 0x0000). This looks like the "Complete Access" record builder code in the slave has a bug. The single reads with slaveinfo do return the correct mapping. The SM2/3 sizes are now one byte short.
  3. In the ENI the slave is configured in synchronous mode. Simple_test does not activate SYNC0 generation.

All three issues are reasons for the slave to throw pre-OP+error when requested to go to safe-OP.

The solution is to fix the bugs in the slave, and build a master that does run in synchronous mode. There are many posts here that show how to do that.

gvcode1 commented 3 years ago

Hi ArthurKetels, thanks for your quick feedback, we will try to fix the EEPROM problem about SM address and "Complete Access" problem, about issue 3, it is quite clear that we will activate the SYNC0 by using dc_sync0 API.

nakarlsson commented 2 years ago

@gvcode1 , can we close this issue?

nakarlsson commented 2 years ago

Closed due to inactivity