OpenEtherCATsociety / SOEM

Simple Open Source EtherCAT Master
Other
1.33k stars 675 forks source link

Not able to write ModeOfOperation PDO #562

Closed VishalAnzo closed 2 years ago

VishalAnzo commented 2 years ago

Hello, I am in a weird situation where I am not sure if I am able to write the ModesOfOperation PDO or not as ModesOfOperationDisplay is always coming as 0. When I write value like 1 or 3 to ModesOfOperation, status PDO changes but ModesOfOperationDisplay PDO never changes from its original value 0. I am stuck here and I need some help from the experts. I am using the SOEM library and this code is working perfect with OMRON servo but I am facing this challenge on FUJI Alpha 7 VC drive. (simple_test function code is attached). I am able to run the OMRON motor in all the modes using this code but not sure why this code is not working fir Fuji.

Output in terminal when I execute the code for FUJI: SOEM (Simple Open EtherCAT Master) Simple test Starting simple test Server listening on 0.0.0.0:50051 ec_init on enp0s31f6 succeeded. 1 slaves found and configured. state 2 assigned rxpdo 1600 assigned txpdo 1a00 state after config in decimal 4 state 4 Slaves mapped, state to SAFE_OP. Request operational state for all slaves Calculated workcounter 3 Operational state reached for all slaves.

############################# also another data to show the mapping of the slave SOEM (Simple Open EtherCAT Master) Slaveinfo Starting slaveinfo ec_init on enp0s31f6 succeeded. 1 slaves found and configured. Calculated workcounter 3

Slave:1 Name:SERVO Output size: 232bits Input size: 104bits State: 4 Delay: 0[ns] Has DC: 1 DCParentport:0 Activeports:1.0.0.0 Configured address: 1001 Man: 0000025e ID: 00010002 Rev: 00010017 SM0 A:1000 L: 128 F:00010026 Type:1 SM1 A:1080 L: 128 F:00010022 Type:2 SM2 A:1100 L: 29 F:00010064 Type:3 SM3 A:1400 L: 13 F:00010020 Type:4 FMMU0 Ls:00000000 Ll: 29 Lsb:0 Leb:7 Ps:1100 Psb:0 Ty:02 Act:01 FMMU1 Ls:0000001d Ll: 13 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 : 0c CoE details: 2f FoE details: 01 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] 0x6060:0x00 0x08 INTEGER8 Modes of operation [0x0001.0] 0x6071:0x00 0x10 INTEGER16 Target torque [0x0003.0] 0x60FF:0x00 0x20 INTEGER32 Target velocity [0x0007.0] 0x6083:0x00 0x20 UNSIGNED32 Profile acceleration [0x000B.0] 0x6084:0x00 0x20 UNSIGNED32 Profile deceleration [0x000F.0] 0x607F:0x00 0x20 UNSIGNED32 Max profile velocity [0x0013.0] 0x6081:0x00 0x20 UNSIGNED32 Profile velocity [0x0017.0] 0x6040:0x00 0x10 UNSIGNED16 Controlword [0x0019.0] 0x607A:0x00 0x20 INTEGER32 Target position SM3 inputs addr b index: sub bitl data_type name [0x001D.0] 0x6041:0x00 0x10 UNSIGNED16 Statusword [0x001F.0] 0x6064:0x00 0x20 INTEGER32 Position actual value [0x0023.0] 0x6061:0x00 0x08 INTEGER8 Modes of operation display [0x0024.0] 0x606C:0x00 0x20 INTEGER32 Velocity actual value [0x0028.0] 0x6077:0x00 0x10 INTEGER16 Torque actual value End slaveinfo, close socket End program

If you can suggest what I am missing in my code, kindly help. I can read the status of the motor, I can write the control words (status changes when I write the Control word) Drive does not change its status after it goes to "Ready to switch on" and I believe this could be because I am not able to write the "Mode of operation" PDO. Kindly help.

Simple_test function.odt

FUJI ESI XML file.odt

ArthurKetels commented 2 years ago

Most likely you do not provide a stable enough PDO timing. From the ESI file you can see the drive supports DC-sync and SM-sync modes. And although SM-sync is "freerun" it could have some timing requirements. Read the manual to see if you can find something. If not, just try to run PDO at exactly 1khz. That should do the trick. Then after a few seconds try to change Modes of operation byte.

nakarlsson commented 2 years ago

Closed due to inactivity