r2k-in-the-vortex / ethercat_src

7 stars 8 forks source link

EtherCAT connection with OpenPLC and Raspberry Pi #5

Open LRAJA33 opened 9 months ago

LRAJA33 commented 9 months ago

Hi,

I have tried to connect Etherlab igh Ethercat master with OpenPLC using ethercat_src. It is working. I can able to read the slave information by running "Ethercat master command".

Screenshot from 2023-11-07 22-51-35

upto this ok? or need to do some more steps for ethercat.

I need to write the code to control the velocity and position of the ethercat servo drive. I dont know how to start. Kindly tell me the procedure. How to write a code to control the servo motor using OpenPLC IDE ? and How to configure ".*xml " file in OpenPLC It would be very helpful , if you share the example code for the same.

r2k-in-the-vortex commented 9 months ago

Looks nice so far, please do sudo ethercat rescan and sudo ethercat xml to obtain ethercat slave configuration, you just need to put what it prints to the conf/master_config.xml file

Then make sure the path to xml is correct in conf/ethercat.cfg and switch configonly to =0 and then if you have everything installed right OpenPLC log should be printing out the ethercat PDO registries you can access in your PLC program.

Servo drive might honestly be a bit of a tall order, you'll be able to access the PDOs just fine, but if you need to configure the drive through SDOs then sorry, that is not implemented. Etherlabs master is capable of it, but my ethercat_src doesn't expose any mechanism for it, that would have to be created from scratch. Unless you are willing to try your hand at that challenge, I hope your drive has some alternative means to configure it, through usb cable or something.

Anyway, let me know how it goes, I would love to hear my code being used and working out for someone's application.

LRAJA33 commented 9 months ago

Dear Friend, Thanks for your kind reply. I have done upto ".xml generation. It would be very helpful if you share the simple code. Based on this i can proceed further. Kindly share sample code

r2k-in-the-vortex commented 9 months ago

Have you installed OpenPLC with ethercat option? If you start it up do you get EtherCAT PDOs printed out in log?

Like:

Slave0_Channel_1 AT %IX0.0 : BOOL; (* EK1814 EtherCAT-EA-Koppler (1A E-Bus, 4 K. Dig. Ein, 3ms, 4 K.  *)
Slave0_Channel_2 AT %IX1.0 : BOOL; (* EK1814 EtherCAT-EA-Koppler (1A E-Bus, 4 K. Dig. Ein, 3ms, 4 K.  *)
Slave0_Channel_3 AT %IX2.0 : BOOL; (* EK1814 EtherCAT-EA-Koppler (1A E-Bus, 4 K. Dig. Ein, 3ms, 4 K.  *)
....

If so, then you are good to go, just declare those in your PLC program as normal and use them.

r2k-in-the-vortex commented 9 months ago

When you press Start PLC button on the web interface, you should get something like this

image

So look at those Runtime Logs and maybe upload that file you sent to pi, should be program_some_name.st

I think there must be something quite wrong there because it sounds like it's not compiling properly

Or you are uploading it incorrectly, you can do it via web interface without needing a pendrive:

image

LRAJA33 commented 9 months ago

Dear friend, I am getting this information while start the PLC. I have shred the image of Web and terminal. I am not getting as you said. Kindly check and give solution terminal Web

r2k-in-the-vortex commented 9 months ago

Hi

I think you don't have EtherCAT option installed for OpenPLC, please use install command as indicated in readme

./install.sh linux ethercat

Even if you have raspberry, still use the same command.

As for hiring, I have a job I'm plenty busy with. I'll gladly answer questions I see popping up here when I notice them, but this is pretty experimental piece of FOSS code with near non-existent user base. It's not a commercial product you can expect to deploy from an install wizard and just plug and play. Takes time and effort to get such things working.

If your end goal is a working servo rather than getting open source code to do something it never has before, then there are companies that sell solutions for that sort of thing, CODESYS Group and Beckhoff to bring examples. And even then, paying quite a bit for software and hardware it's not one hour type of task from zero to working result.

r2k-in-the-vortex commented 9 months ago

In the ethercat.cfg file, switch that to 0 image

and verbose to 1 gives you more info image

I think you almost have everything set up

If you previously did anything to enable modbus, undo that, I don't know how it interacts with ethercat

r2k-in-the-vortex commented 9 months ago

Looks to me like everything is ok on the ethercat side, modbus is what explodes on trying to open port 502

See if you can disable it

Also, could you post contents of your master_config.xml, as text or file not image

LRAJA33 commented 9 months ago

Dear friend Kindly check the master_config.xml. The error is"Socket error during runtime_logs(), is the runtime active?" how to resolve it? master_configxml.txt

r2k-in-the-vortex commented 9 months ago

Alright, I went through that xml and I think I know what the issues are and all of them are solvable by slightly modifying the xml

First issue, pdo entry Name properties are empty and it doesn't handle it properly, bug on my end <Name></Name> simply add names there

Second issue, multiple entries per Pdo elements, I don't think I have built handling for that. Just needs manual reformatting a bit so each entry is in separate pdo element

      <RxPdo Sm="2" Fixed="1" Mandatory="1">
        <Index>#x1601</Index>
        <Name>2nd Recive PDO Maping</Name>
       <Entry>
         <Index>#x6040</Index>
         <SubIndex>0</SubIndex>
         <BitLen>16</BitLen>
         <Name></Name>
         <DataType>UINT16</DataType>
       </Entry>
       <Entry>
         <Index>#x607a</Index>
         <SubIndex>0</SubIndex>
         <BitLen>32</BitLen>
         <Name></Name>
         <DataType>UINT32</DataType>
       </Entry>
       <Entry>
         <Index>#x60ff</Index>
         <SubIndex>0</SubIndex>
         <BitLen>32</BitLen>
         <Name></Name>
         <DataType>UINT32</DataType>
       </Entry>

Third issue - UINT32 registers, I think on OpenPLC side there was some gap in implementing those way back when so they are not implemented in ethercat_src. Those registries need to be broken up to two UINT16 types each.

I improvised a bit based on https://d.veichi.com/manual/sd700-ethercat-communication-manual-v1.0.pdf and this is what I came up with

master_configsolutionxml.txt

at least in config only mode it does it's thing now, no idea how it will perform with actual hardware, some creativity in further customizing the xml file might be needed if things don't work right

image

LRAJA33 commented 9 months ago

Dear friend, Its working. Hearty thanks. !!

Full log: OpenPLC Runtime starting... Interactive Server: Listening on port 43628 Configuring EtherCAT PLC IO Printout, copy this to VAR..END_VAR of main program or something Variable names may be modified at will as long as the adresses and variable sizes remain the same Slave0_Status_Word_registry AT %IW0.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_Actual_location_registry_A AT %IW1.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_Actual_location_registry_B AT %IW2.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_Control_Word_registry AT %QW0.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_Target_position_registry_A AT %QW1.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_Target_position_registry_B AT %QW2.0 : UINT; ( SD700_ECAT_V1.2_G ) Skipping configuration of Slave Devices (mbconfig.cfg file not found) Warning: Persistent Storage file not found EtherCAT simulation only Issued start_modbus() command to start on port: 502 Server: error binding socket => Permission denied Server: waiting for new client... Issued start_dnp3() command to start on port: 20000 DNP3 ID manager: Starting thread (0) DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000 Issued start_enip() command to start on port: 44818 Server: Listening on port 44818 Server: waiting for new client... Issued stop_pstorage() command Screenshot from 2023-11-17 00-17-43

LRAJA33 commented 9 months ago

Hi, why i am not getting response like this "4 slave(s). AL states: PREOP. Link is up. Domain1: WC 3. Domain1: State 1. Domain1: WC 4. Domain1: WC 5. Domain1: WC 7. Domain1: State 2. AL states: OP."

Is everything ok? Shall i test with PLC code?

Now i am getting logs in run time. upto this what we called? ethercat connection established with openPLC? can you share the blink code you have done with ek100? i am totally new to this one. i need one reference code. with that i can able to complete. Kindly send

r2k-in-the-vortex commented 9 months ago

nice!

If you scroll down in the runtime logs what does the rest of it look like? And are the status indicators on the ethernet ports blinking and looking like communication is happening?

As for bare bones simplest blink in OpenPLC? Like so: image

Which will yield structured text output file for uploading to web interface like so

PROGRAM program0
  VAR
    Output1 AT %QX0.0 : BOOL;
  END_VAR

  Output1 := not Output1;
END_PROGRAM

CONFIGURATION Config0

  RESOURCE Res0 ON PLC
    TASK task0(INTERVAL := T#20ms,PRIORITY := 0);
    PROGRAM instance0 WITH task0 : program0;
  END_RESOURCE
END_CONFIGURATION

But of course your situation is quite a bit more complex than blinky-blink, you have status and control words not a singular boolean output

r2k-in-the-vortex commented 9 months ago

Here is where you would find indication that everything is working right with EtherCAT

https://github.com/r2k-in-the-vortex/ethercat_src/assets/30666740/625ed606-5665-4db6-9826-24d429b2edbe

LRAJA33 commented 9 months ago

Dear friend, Thanks for your unconditional support. These are the full logs of run time

Full log: OpenPLC Runtime starting... Interactive Server: Listening on port 43628 Configuring EtherCAT PLC IO Printout, copy this to VAR..END_VAR of main program or something Variable names may be modified at will as long as the adresses and variable sizes remain the same Slave0_Status_Word_registry AT %IW0.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_Actual_location_registry_A AT %IW1.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_Actual_location_registry_B AT %IW2.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_Control_Word_registry AT %QW0.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_Target_position_registry_A AT %QW1.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_Target_position_registry_B AT %QW2.0 : UINT; ( SD700_ECAT_V1.2_G ) Skipping configuration of Slave Devices (mbconfig.cfg file not found) Warning: Persistent Storage file not found EtherCAT simulation only Issued start_modbus() command to start on port: 502 Server: error binding socket => Permission denied Server: waiting for new client... Issued start_dnp3() command to start on port: 20000 DNP3 ID manager: Starting thread (0) DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000 Issued start_enip() command to start on port: 44818 Server: Listening on port 44818 Server: waiting for new client... Issued stop_pstorage() command

thanks for the reference code i will work on it

r2k-in-the-vortex commented 9 months ago

EtherCAT simulation only

Turn configonlyparam off, I need to use it because I dont have real sd700 slave device, but you have real hardware so on your end this param should be set to 0.

LRAJA33 commented 9 months ago

Hi, How did you find the vendor Id, product code and revision number? i have referred manual unable to get it.

Id = 8716548

ProductCode="#x01030507" RevisionNo="#x02040608"

LRAJA33 commented 9 months ago

Dear friend,

I have compared your xml with sd700 (modified by you). your xml fille working good. and while using sd700 xml file "Sync master 0 [error invalid direction]" error coming. how to solve this sync master error? and other errors are 15:03:53 ERROR /home/lraja/OpenPLCRpi/OpenPLC_v3/utils/ethercat_src/src/ecat_handler/ecat_handler.c:219: Failed to configure PDO-s 15:03:53 ERROR /home/lraja/OpenPLCRpi/OpenPLC_v3/utils/ethercat_src/src/ecat_handler/ecat_handler.c:379: Failed to configure slave 15:03:53 ERROR /home/lraja/OpenPLCRpi/OpenPLC_v3/utils/ethercat_src/src/ecat_handler/ecat_handler.c:426: Releasing master

Screenshot from 2023-11-18 15-33-24

kindly tell what are the parameter need to configure correctly? i will modify and try

r2k-in-the-vortex commented 9 months ago

Alright, I found a few issues that are likely affecting you

This is not a case for BOOL type digital IO, but with byte, int, dint registers, if you have a it in EtherCAT IO conf, you need to have it in PLC program too. So if your IO conf says this: Slave0_Status_Word_registry AT %IW0.0 : UINT; ( SD700_ECAT_V1.2_G )

But if you are running a blank program with nothing declared at %IW0.0, it just segfaults the moment ethercat starts working.

Id, Product code, revision etc those all came from your initial conf file, nowhere else.

I don't quite understand the logic of all those modifications you did in your version of xml, lets try the other way, make it as minimal as possible, try the following, it has control register, status register and nothing else.

This will print out IO conf like so:

Slave0_2nd_Send_PDO_Maping AT %IW0.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_2nd_Recive_PDO_Maping AT %QW0.0 : UINT; (* SD700_ECAT_V1.2_G *)

So make sure you have those declared in your plc program

<EtherCATInfoList>
    <EtherCATInfo>
        <!-- Slave 0 -->
        <Vendor>
            <Id>8716548</Id>
        </Vendor>
        <Descriptions>
            <Devices>
                <Device>
                    <Type ProductCode="#x01030507" RevisionNo="#x02040608">SD700_ECAT Drive</Type>
                    <Name><![CDATA[SD700_ECAT_V1.2_G]]></Name>
                    <Sm Enable="1" StartAddress="#x1100" ControlByte="#x64" DefaultSize="2"/>
                    <Sm Enable="1" StartAddress="#x1400" ControlByte="#x20" DefaultSize="6"/>
                    <RxPdo Sm="0" Fixed="1" Mandatory="1">
                        <Index>#x1601</Index>
                        <Name>2nd Recive PDO Maping</Name>
                        <Entry>
                            <Index>#x6040</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>ControlRegister</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <TxPdo Sm="1" Fixed="1" Mandatory="1">
                        <Index>#x1a01</Index>
                        <Name>2nd Send PDO Maping</Name>
                        <Entry>
                            <Index>#x6041</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>StatusRegister</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                </Device>
            </Devices>
        </Descriptions>
    </EtherCATInfo>
</EtherCATInfoList>
LRAJA33 commented 9 months ago

Dear Friend,,

Thank you for your continuous support. I have done it. Kindly check and acknowledge. I have shared the image for your reference Screenshot from 2023-11-19 19-32-13 Screenshot from 2023-11-19 19-32-45 Screenshot from 2023-11-19 19-33-19 Screenshot from 2023-11-19 19-33-27

One more help. I want to to write one simple code to turn on and turn off the servo. Now we have configured only status word and control word. Kindly give one simple code to communicate and get the response from servo drive. I have tried one example but it is not working Screenshot from 2023-11-19 21-24-28

Kindly help me friend

r2k-in-the-vortex commented 9 months ago

Well, the good news is the configuration passes successfully and EtherCAT has started communicating.

The bad news is, the drive is stuck in SAFEOP, which means it's not going to do anything. That is likely because we removed those other pdo entries to simplify the problem, so one by one you need to add those back.

Next RxPDO entry is 607a, target location, but it's a 32bit register, OpenPLC only supports up to 16 bit registers. So have to break it up and hope it can work. Same story for 6064 location actual. Let see, try the following:

<EtherCATInfoList>
    <EtherCATInfo>
        <!-- Slave 0 -->
        <Vendor>
            <Id>8716548</Id>
        </Vendor>
        <Descriptions>
            <Devices>
                <Device>
                    <Type ProductCode="#x01030507" RevisionNo="#x02040608">SD700_ECAT Drive</Type>
                    <Name><![CDATA[SD700_ECAT_V1.2_G]]></Name>
                    <Sm Enable="1" StartAddress="#x1100" ControlByte="#x64" DefaultSize="2"/>
                    <Sm Enable="1" StartAddress="#x1400" ControlByte="#x20" DefaultSize="6"/>
                    <RxPdo Sm="0" Fixed="1" Mandatory="1">
                        <Index>#x1601</Index>
                        <Name>2nd Recive PDO Maping</Name>
                        <Entry>
                            <Index>#x6040</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>ControlRegister</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="0" Fixed="1" Mandatory="1">
                        <Index>#x1603</Index>
                        <Name>TargetPosA</Name>
                        <Entry>
                            <Index>#x607a</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="0" Fixed="1" Mandatory="1">
                        <Index>#x1605</Index>
                        <Name>TargetPosB</Name>
                        <Entry>
                            <Index>#x607c</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <TxPdo Sm="1" Fixed="1" Mandatory="1">
                        <Index>#x1a01</Index>
                        <Name>2nd Send PDO Maping</Name>
                        <Entry>
                            <Index>#x6041</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>StatusRegister</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="1" Fixed="1" Mandatory="1">
                        <Index>#x1a03</Index>
                        <Name>ActualLocationA</Name>
                        <Entry>
                            <Index>#x6064</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="1" Fixed="1" Mandatory="1">
                        <Index>#x1a05</Index>
                        <Name>ActualLocationB</Name>
                        <Entry>
                            <Index>#x6066</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                </Device>
            </Devices>
        </Descriptions>
    </EtherCATInfo>
</EtherCATInfoList>

Make sure to update on PLC program side and add necessary variables.

Slave0_2nd_Send_PDO_Maping AT %IW0.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_ActualLocationA AT %IW1.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_ActualLocationB AT %IW2.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_2nd_Recive_PDO_Maping AT %QW0.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_TargetPosA AT %QW1.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_TargetPosB AT %QW2.0 : UINT; (* SD700_ECAT_V1.2_G *)
LRAJA33 commented 9 months ago

Hi, I am getting the following response after adding the Next PDOs

Run time log:

OpenPLC Runtime starting... Interactive Server: Listening on port 43628 Configuring EtherCAT PLC IO Printout, copy this to VAR..END_VAR of main program or something Variable names may be modified at will as long as the adresses and variable sizes remain the same Slave0_2nd_Send_PDO_Maping AT %IW0.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_ActualLocationA AT %IW1.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_ActualLocationB AT %IW2.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_2nd_Recive_PDO_Maping AT %QW0.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_TargetPosA AT %QW1.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_TargetPosB AT %QW2.0 : UINT; ( SD700_ECAT_V1.2_G ) Persistent Storage: Reading persistent.file into local buffers enabled 1 slave(s). AL states: PREOP. Link is up. Issued start_modbus() command to start on port: 502 Server: Listening on port 502 Server: waiting for new client... Issued start_dnp3() command to start on port: 20000 DNP3 ID manager: Starting thread (0) DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000 Issued start_enip() command to start on port: 44818 Server: Listening on port 44818 Server: waiting for new client... Issued start_pstorage() command with polling rate of 10 seconds Domain1: WC 2. Domain1: State 1. AL states: SAFEOP.

Again servo drive is stuck in SAFEOP

r2k-in-the-vortex commented 9 months ago

Try sudo ethercat pdos see what it prints out, the XML probably has to made to match

LRAJA33 commented 9 months ago

hi, the pdos response

lraja@lraja-desktop:~/OpenPLCRpi/OpenPLC_v3$ sudo ethercat pdos SM0: PhysAddr 0x1000, DefaultSize 128, ControlRegister 0x26, Enable 1 SM1: PhysAddr 0x1080, DefaultSize 128, ControlRegister 0x22, Enable 1 SM2: PhysAddr 0x1100, DefaultSize 2, ControlRegister 0x64, Enable 1 RxPDO 0x1601 "2nd Recive PDO Maping" PDO entry 0x6040:00, 16 bit, "" PDO entry 0x607a:00, 32 bit, "" PDO entry 0x60ff:00, 32 bit, "" SM3: PhysAddr 0x1400, DefaultSize 6, ControlRegister 0x20, Enable 1 TxPDO 0x1a01 "2nd Send PDO Maping" PDO entry 0x6041:00, 16 bit, "" PDO entry 0x6064:00, 32 bit, "" PDO entry 0x606c:00, 32 bit, ""

r2k-in-the-vortex commented 9 months ago

Well, it wants those 0x60ff and 0x606c velocity registers, try adding them see if that improves things

Slave0_2nd_Send_PDO_Maping AT %IW0.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_ActualLocationA AT %IW1.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_ActualLocationB AT %IW2.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_ActualVeloA AT %IW3.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_ActualVeloB AT %IW4.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_2nd_Recive_PDO_Maping AT %QW0.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_TargetPosA AT %QW1.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_TargetPosB AT %QW2.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_TargetVeloA AT %QW3.0 : UINT; (* SD700_ECAT_V1.2_G *)
Slave0_TargetVeloB AT %QW4.0 : UINT; (* SD700_ECAT_V1.2_G *)

Add PLC variables too of course

<EtherCATInfoList>
    <EtherCATInfo>
        <!-- Slave 0 -->
        <Vendor>
            <Id>8716548</Id>
        </Vendor>
        <Descriptions>
            <Devices>
                <Device>
                    <Type ProductCode="#x01030507" RevisionNo="#x02040608">SD700_ECAT Drive</Type>
                    <Name><![CDATA[SD700_ECAT_V1.2_G]]></Name>
                    <Sm Enable="1" StartAddress="#x1100" ControlByte="#x64" DefaultSize="2"/>
                    <Sm Enable="1" StartAddress="#x1400" ControlByte="#x20" DefaultSize="6"/>
                    <RxPdo Sm="0" Fixed="1" Mandatory="1">
                        <Index>#x1601</Index>
                        <Name>2nd Recive PDO Maping</Name>
                        <Entry>
                            <Index>#x6040</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>ControlRegister</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="0" Fixed="1" Mandatory="1">
                        <Index>#x1603</Index>
                        <Name>TargetPosA</Name>
                        <Entry>
                            <Index>#x607a</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="0" Fixed="1" Mandatory="1">
                        <Index>#x1605</Index>
                        <Name>TargetPosB</Name>
                        <Entry>
                            <Index>#x607c</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="0" Fixed="1" Mandatory="1">
                        <Index>#x1607</Index>
                        <Name>TargetVeloA</Name>
                        <Entry>
                            <Index>#x60ff</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="0" Fixed="1" Mandatory="1">
                        <Index>#x1609</Index>
                        <Name>TargetVeloB</Name>
                        <Entry>
                            <Index>#x6101</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <TxPdo Sm="1" Fixed="1" Mandatory="1">
                        <Index>#x1a01</Index>
                        <Name>2nd Send PDO Maping</Name>
                        <Entry>
                            <Index>#x6041</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>StatusRegister</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="1" Fixed="1" Mandatory="1">
                        <Index>#x1a03</Index>
                        <Name>ActualLocationA</Name>
                        <Entry>
                            <Index>#x6064</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="1" Fixed="1" Mandatory="1">
                        <Index>#x1a05</Index>
                        <Name>ActualLocationB</Name>
                        <Entry>
                            <Index>#x6066</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="1" Fixed="1" Mandatory="1">
                        <Index>#x1a07</Index>
                        <Name>ActualVeloA</Name>
                        <Entry>
                            <Index>#x606c</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="1" Fixed="1" Mandatory="1">
                        <Index>#x1a09</Index>
                        <Name>ActualVeloB</Name>
                        <Entry>
                            <Index>#x606e</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                </Device>
            </Devices>
        </Descriptions>
    </EtherCATInfo>
</EtherCATInfoList>
LRAJA33 commented 9 months ago

Hi, the web runtime response after adding the above one

web runtime:

OpenPLC Runtime starting... Interactive Server: Listening on port 43628 Configuring EtherCAT PLC IO Printout, copy this to VAR..END_VAR of main program or something Variable names may be modified at will as long as the adresses and variable sizes remain the same Slave0_2nd_Send_PDO_Maping AT %IW0.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_ActualLocationA AT %IW1.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_ActualLocationB AT %IW2.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_ActualVeloA AT %IW3.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_ActualVeloB AT %IW4.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_2nd_Recive_PDO_Maping AT %QW0.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_TargetPosA AT %QW1.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_TargetPosB AT %QW2.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_TargetVeloA AT %QW3.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_TargetVeloB AT %QW4.0 : UINT; ( SD700_ECAT_V1.2_G ) Persistent Storage: Reading persistent.file into local buffers enabled 1 slave(s). AL states: SAFEOP. Link is up. Domain1: WC 2. Domain1: State 1. Issued start_modbus() command to start on port: 502 Server: Listening on port 502 Server: waiting for new client... Issued start_dnp3() command to start on port: 20000 DNP3 ID manager: Starting thread (0) DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000 Issued start_enip() command to start on port: 44818 Server: Listening on port 44818 Server: waiting for new client... Issued start_pstorage() command with polling rate of 10 seconds

r2k-in-the-vortex commented 9 months ago

hmmmm... maybe it really wants those sync managers with zero PDOs on them for some reason

SM0: PhysAddr 0x1000, DefaultSize 128, ControlRegister 0x26, Enable 1 SM1: PhysAddr 0x1080, DefaultSize 128, ControlRegister 0x22, Enable 1

As you remember, that threw an error previously, well, I did an update so it should at least pass configuration. So first pull latest https://github.com/r2k-in-the-vortex/ethercat_src then redo ./install.sh linux ethercat for OpenPLC and then try the following xml

<EtherCATInfoList>
    <EtherCATInfo>
        <!-- Slave 0 -->
        <Vendor>
            <Id>8716548</Id>
        </Vendor>
        <Descriptions>
            <Devices>
                <Device>
                    <Type ProductCode="#x01030507" RevisionNo="#x02040608">SD700_ECAT Drive</Type>
                    <Name><![CDATA[SD700_ECAT_V1.2_G]]></Name>
                    <Sm Enable="1" StartAddress="#x1000" ControlByte="#x26" DefaultSize="128" />
                    <Sm Enable="1" StartAddress="#x1080" ControlByte="#x22" DefaultSize="128" />
                    <Sm Enable="1" StartAddress="#x1100" ControlByte="#x64" DefaultSize="2"/>
                    <Sm Enable="1" StartAddress="#x1400" ControlByte="#x20" DefaultSize="6"/>
                    <RxPdo Sm="2" Fixed="1" Mandatory="1">
                        <Index>#x1601</Index>
                        <Name>2nd Recive PDO Maping</Name>
                        <Entry>
                            <Index>#x6040</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>ControlRegister</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="2" Fixed="1" Mandatory="1">
                        <Index>#x1603</Index>
                        <Name>TargetPosA</Name>
                        <Entry>
                            <Index>#x607a</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="2" Fixed="1" Mandatory="1">
                        <Index>#x1605</Index>
                        <Name>TargetPosB</Name>
                        <Entry>
                            <Index>#x607c</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="2" Fixed="1" Mandatory="1">
                        <Index>#x1607</Index>
                        <Name>TargetVeloA</Name>
                        <Entry>
                            <Index>#x60ff</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="2" Fixed="1" Mandatory="1">
                        <Index>#x1609</Index>
                        <Name>TargetVeloB</Name>
                        <Entry>
                            <Index>#x6101</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <TxPdo Sm="3" Fixed="1" Mandatory="1">
                        <Index>#x1a01</Index>
                        <Name>2nd Send PDO Maping</Name>
                        <Entry>
                            <Index>#x6041</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>StatusRegister</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="3" Fixed="1" Mandatory="1">
                        <Index>#x1a03</Index>
                        <Name>ActualLocationA</Name>
                        <Entry>
                            <Index>#x6064</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="3" Fixed="1" Mandatory="1">
                        <Index>#x1a05</Index>
                        <Name>ActualLocationB</Name>
                        <Entry>
                            <Index>#x6066</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="3" Fixed="1" Mandatory="1">
                        <Index>#x1a07</Index>
                        <Name>ActualVeloA</Name>
                        <Entry>
                            <Index>#x606c</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="3" Fixed="1" Mandatory="1">
                        <Index>#x1a09</Index>
                        <Name>ActualVeloB</Name>
                        <Entry>
                            <Index>#x606e</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                </Device>
            </Devices>
        </Descriptions>
    </EtherCATInfo>
</EtherCATInfoList>
LRAJA33 commented 9 months ago

Dear friend, I have referred one forum related to SAFEOP . They shared the below solution

"Ok so I have solved this problem. The dual channel AX5000 does take a very long time to transition from PREOP->SAFEOP->OP.

I changed this in the ethercat master to 10 seconds. +#define EC_AL_STATE_CHANGE_TIMEOUT 10

After that things have worked reliably."

Is it acceptable solution? if so , tell where i have to change to increase the time. I tried but i could not get the right parameter

Kindly help me

r2k-in-the-vortex commented 9 months ago

I don't think this is the issue you are having. This is not the same drive and you know the master conf is less than perfect fit because of OpenPLC compadibilities. It's not surprising it stays stuck in safeop when it doesn't get exactly the configuration it's asking for.

But if you wanted to change it, then here this parameter is https://gitlab.com/etherlab.org/ethercat/-/blob/master/master/fsm_change.c#L45

LRAJA33 commented 9 months ago

Yes. This solution not working. I will pull the latest one and try it as you suggested

LRAJA33 commented 9 months ago

I have pulled the recent files Screenshot from 2023-11-20 00-35-04 No change , still drive stuck in SAFEOP

Web LOg:

OpenPLC Runtime starting... Interactive Server: Listening on port 43628 Configuring EtherCAT PLC IO Printout, copy this to VAR..END_VAR of main program or something Variable names may be modified at will as long as the adresses and variable sizes remain the same Slave0_2nd_Send_PDO_Maping AT %IW0.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_ActualLocationA AT %IW1.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_ActualLocationB AT %IW2.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_ActualVeloA AT %IW3.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_ActualVeloB AT %IW4.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_2nd_Recive_PDO_Maping AT %QW0.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_TargetPosA AT %QW1.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_TargetPosB AT %QW2.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_TargetVeloA AT %QW3.0 : UINT; ( SD700_ECAT_V1.2_G ) Slave0_TargetVeloB AT %QW4.0 : UINT; ( SD700_ECAT_V1.2_G ) Persistent Storage: Reading persistent.file into local buffers enabled 1 slave(s). AL states: SAFEOP. Link is up. Domain1: WC 2. Domain1: State 1. Issued start_modbus() command to start on port: 502 Server: Listening on port 502 Server: waiting for new client... Issued start_dnp3() command to start on port: 20000 DNP3 ID manager: Starting thread (0) DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000 Issued start_enip() command to start on port: 44818 Server: Listening on port 44818 Server: waiting for new client... Issued start_pstorage() command with polling rate of 10 seconds

r2k-in-the-vortex commented 9 months ago

Hmmzz.... I guess it really wants those registers to be 32bit not 2x16bit then.

I think this is an update I can do, but not today, I'll see about it tomorrow evening.

LRAJA33 commented 9 months ago

Ok..friend.

On Mon, 20 Nov, 2023, 1:09 am r2k-in-the-vortex, @.***> wrote:

Hmmzz.... I guess it really wants those registers to be 32bit not 2x16bit then.

I think this is an update I can do, but not today, I'll see about it tomorrow evening.

— Reply to this email directly, view it on GitHub https://github.com/r2k-in-the-vortex/ethercat_src/issues/5#issuecomment-1817956983, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZCBRFNKF6MMARHARLCSHCDYFJN6TAVCNFSM6AAAAAA7BQZF4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXHE2TMOJYGM . You are receiving this because you authored the thread.Message ID: @.***>

LRAJA33 commented 9 months ago

Dear friend, Any update. ? Kindly tell the ways I will.also try

r2k-in-the-vortex commented 9 months ago

Alright, see what the following does

https://github.com/r2k-in-the-vortex/ethercat_src/tree/wideregistersupport https://github.com/r2k-in-the-vortex/OpenPLC_v3/tree/wideregistersupport

and the xml as follows

<EtherCATInfoList>
    <EtherCATInfo>
        <!-- Slave 0 -->
        <Vendor>
            <Id>8716548</Id>
        </Vendor>
        <Descriptions>
            <Devices>
                <Device>
                    <Type ProductCode="#x01030507" RevisionNo="#x02040608">SD700_ECAT Drive</Type>
                    <Name><![CDATA[SD700_ECAT_V1.2_G]]></Name>
                    <Sm Enable="1" StartAddress="#x1000" ControlByte="#x26" DefaultSize="128" />
                    <Sm Enable="1" StartAddress="#x1080" ControlByte="#x22" DefaultSize="128" />
                    <Sm Enable="1" StartAddress="#x1100" ControlByte="#x64" DefaultSize="2"/>
                    <Sm Enable="1" StartAddress="#x1400" ControlByte="#x20" DefaultSize="6"/>
                    <RxPdo Sm="2" Fixed="1" Mandatory="1">
                        <Index>#x1601</Index>
                        <Name>2nd Recive PDO Maping</Name>
                        <Entry>
                            <Index>#x6040</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>ControlRegister</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="2" Fixed="1" Mandatory="1">
                        <Index>#x1603</Index>
                        <Name>TargetPos</Name>
                        <Entry>
                            <Index>#x607a</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>32</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT32</DataType>
                        </Entry>
                    </RxPdo>
                    <RxPdo Sm="2" Fixed="1" Mandatory="1">
                        <Index>#x1607</Index>
                        <Name>TargetVelo</Name>
                        <Entry>
                            <Index>#x60ff</Index>
                            <SubIndex>1</SubIndex>
                            <BitLen>32</BitLen>
                            <Name>Output</Name>
                            <DataType>UINT32</DataType>
                        </Entry>
                    </RxPdo>
                    <TxPdo Sm="3" Fixed="1" Mandatory="1">
                        <Index>#x1a01</Index>
                        <Name>2nd Send PDO Maping</Name>
                        <Entry>
                            <Index>#x6041</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>16</BitLen>
                            <Name>StatusRegister</Name>
                            <DataType>UINT16</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="3" Fixed="1" Mandatory="1">
                        <Index>#x1a03</Index>
                        <Name>ActualLocation</Name>
                        <Entry>
                            <Index>#x6064</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>32</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT32</DataType>
                        </Entry>
                    </TxPdo>
                    <TxPdo Sm="3" Fixed="1" Mandatory="1">
                        <Index>#x1a07</Index>
                        <Name>ActualVelo</Name>
                        <Entry>
                            <Index>#x606c</Index>
                            <SubIndex>0</SubIndex>
                            <BitLen>32</BitLen>
                            <Name>Input</Name>
                            <DataType>UINT32</DataType>
                        </Entry>
                    </TxPdo>
                </Device>
            </Devices>
        </Descriptions>
    </EtherCATInfo>
</EtherCATInfoList>

with io conf like so

  VAR
    Slave0_2nd_Send_PDO_Maping AT %IW0.0 : UINT; (* SD700_ECAT_V1.2_G *)
    Slave0_ActualLocation AT %ID1.0 : DINT; (* SD700_ECAT_V1.2_G *)
    Slave0_ActualVelo AT %ID2.0 : DINT; (* SD700_ECAT_V1.2_G *)
    Slave0_2nd_Recive_PDO_Maping AT %QW0.0 : UINT; (* SD700_ECAT_V1.2_G *)
    Slave0_TargetPos AT %QD1.0 : DINT; (* SD700_ECAT_V1.2_G *)
    Slave0_TargetVelo AT %QD2.0 : DINT; (* SD700_ECAT_V1.2_G *)
  END_VAR
LRAJA33 commented 9 months ago

Alright, see what the following does

https://github.com/r2k-in-the-vortex/ethercat_src/tree/wideregistersupport https://github.com/r2k-in-the-vortex/OpenPLC_v3/tree/wideregistersupport

and the xml as follows

<EtherCATInfoList>
  <EtherCATInfo>
      <!-- Slave 0 -->
      <Vendor>
          <Id>8716548</Id>
      </Vendor>
      <Descriptions>
          <Devices>
              <Device>
                  <Type ProductCode="#x01030507" RevisionNo="#x02040608">SD700_ECAT Drive</Type>
                  <Name><![CDATA[SD700_ECAT_V1.2_G]]></Name>
                  <Sm Enable="1" StartAddress="#x1000" ControlByte="#x26" DefaultSize="128" />
                  <Sm Enable="1" StartAddress="#x1080" ControlByte="#x22" DefaultSize="128" />
                  <Sm Enable="1" StartAddress="#x1100" ControlByte="#x64" DefaultSize="2"/>
                  <Sm Enable="1" StartAddress="#x1400" ControlByte="#x20" DefaultSize="6"/>
                  <RxPdo Sm="2" Fixed="1" Mandatory="1">
                      <Index>#x1601</Index>
                      <Name>2nd Recive PDO Maping</Name>
                      <Entry>
                          <Index>#x6040</Index>
                          <SubIndex>0</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>ControlRegister</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </RxPdo>
                  <RxPdo Sm="2" Fixed="1" Mandatory="1">
                      <Index>#x1603</Index>
                      <Name>TargetPos</Name>
                      <Entry>
                          <Index>#x607a</Index>
                          <SubIndex>1</SubIndex>
                          <BitLen>32</BitLen>
                          <Name>Output</Name>
                          <DataType>UINT32</DataType>
                      </Entry>
                  </RxPdo>
                  <RxPdo Sm="2" Fixed="1" Mandatory="1">
                      <Index>#x1607</Index>
                      <Name>TargetVelo</Name>
                      <Entry>
                          <Index>#x60ff</Index>
                          <SubIndex>1</SubIndex>
                          <BitLen>32</BitLen>
                          <Name>Output</Name>
                          <DataType>UINT32</DataType>
                      </Entry>
                  </RxPdo>
                  <TxPdo Sm="3" Fixed="1" Mandatory="1">
                      <Index>#x1a01</Index>
                      <Name>2nd Send PDO Maping</Name>
                      <Entry>
                          <Index>#x6041</Index>
                          <SubIndex>0</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>StatusRegister</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </TxPdo>
                  <TxPdo Sm="3" Fixed="1" Mandatory="1">
                      <Index>#x1a03</Index>
                      <Name>ActualLocation</Name>
                      <Entry>
                          <Index>#x6064</Index>
                          <SubIndex>0</SubIndex>
                          <BitLen>32</BitLen>
                          <Name>Input</Name>
                          <DataType>UINT32</DataType>
                      </Entry>
                  </TxPdo>
                  <TxPdo Sm="3" Fixed="1" Mandatory="1">
                      <Index>#x1a07</Index>
                      <Name>ActualVelo</Name>
                      <Entry>
                          <Index>#x606c</Index>
                          <SubIndex>0</SubIndex>
                          <BitLen>32</BitLen>
                          <Name>Input</Name>
                          <DataType>UINT32</DataType>
                      </Entry>
                  </TxPdo>
              </Device>
          </Devices>
      </Descriptions>
  </EtherCATInfo>
</EtherCATInfoList>

with io conf like so

  VAR
    Slave0_2nd_Send_PDO_Maping AT %IW0.0 : UINT; (* SD700_ECAT_V1.2_G *)
    Slave0_ActualLocation AT %ID1.0 : DINT; (* SD700_ECAT_V1.2_G *)
    Slave0_ActualVelo AT %ID2.0 : DINT; (* SD700_ECAT_V1.2_G *)
    Slave0_2nd_Recive_PDO_Maping AT %QW0.0 : UINT; (* SD700_ECAT_V1.2_G *)
    Slave0_TargetPos AT %QD1.0 : DINT; (* SD700_ECAT_V1.2_G *)
    Slave0_TargetVelo AT %QD2.0 : DINT; (* SD700_ECAT_V1.2_G *)
  END_VAR

Dear friend, This is not working for me

Screenshot from 2023-11-21 18-25-41

LRAJA33 commented 9 months ago

hmmmm... maybe it really wants those sync managers with zero PDOs on them for some reason

SM0: PhysAddr 0x1000, DefaultSize 128, ControlRegister 0x26, Enable 1 SM1: PhysAddr 0x1080, DefaultSize 128, ControlRegister 0x22, Enable 1

As you remember, that threw an error previously, well, I did an update so it should at least pass configuration. So first pull latest https://github.com/r2k-in-the-vortex/ethercat_src then redo ./install.sh linux ethercat for OpenPLC and then try the following xml


<EtherCATInfoList>
  <EtherCATInfo>
      <!-- Slave 0 -->
      <Vendor>
          <Id>8716548</Id>
      </Vendor>
      <Descriptions>
          <Devices>
              <Device>
                  <Type ProductCode="#x01030507" RevisionNo="#x02040608">SD700_ECAT Drive</Type>
                  <Name><![CDATA[SD700_ECAT_V1.2_G]]></Name>
                  <Sm Enable="1" StartAddress="#x1000" ControlByte="#x26" DefaultSize="128" />
                  <Sm Enable="1" StartAddress="#x1080" ControlByte="#x22" DefaultSize="128" />
                  <Sm Enable="1" StartAddress="#x1100" ControlByte="#x64" DefaultSize="2"/>
                  <Sm Enable="1" StartAddress="#x1400" ControlByte="#x20" DefaultSize="6"/>
                  <RxPdo Sm="2" Fixed="1" Mandatory="1">
                      <Index>#x1601</Index>
                      <Name>2nd Recive PDO Maping</Name>
                      <Entry>
                          <Index>#x6040</Index>
                          <SubIndex>0</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>ControlRegister</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </RxPdo>
                  <RxPdo Sm="2" Fixed="1" Mandatory="1">
                      <Index>#x1603</Index>
                      <Name>TargetPosA</Name>
                      <Entry>
                          <Index>#x607a</Index>
                          <SubIndex>1</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>Output</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </RxPdo>
                  <RxPdo Sm="2" Fixed="1" Mandatory="1">
                      <Index>#x1605</Index>
                      <Name>TargetPosB</Name>
                      <Entry>
                          <Index>#x607c</Index>
                          <SubIndex>1</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>Output</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </RxPdo>
                  <RxPdo Sm="2" Fixed="1" Mandatory="1">
                      <Index>#x1607</Index>
                      <Name>TargetVeloA</Name>
                      <Entry>
                          <Index>#x60ff</Index>
                          <SubIndex>1</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>Output</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </RxPdo>
                  <RxPdo Sm="2" Fixed="1" Mandatory="1">
                      <Index>#x1609</Index>
                      <Name>TargetVeloB</Name>
                      <Entry>
                          <Index>#x6101</Index>
                          <SubIndex>1</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>Output</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </RxPdo>
                  <TxPdo Sm="3" Fixed="1" Mandatory="1">
                      <Index>#x1a01</Index>
                      <Name>2nd Send PDO Maping</Name>
                      <Entry>
                          <Index>#x6041</Index>
                          <SubIndex>0</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>StatusRegister</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </TxPdo>
                  <TxPdo Sm="3" Fixed="1" Mandatory="1">
                      <Index>#x1a03</Index>
                      <Name>ActualLocationA</Name>
                      <Entry>
                          <Index>#x6064</Index>
                          <SubIndex>0</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>Input</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </TxPdo>
                  <TxPdo Sm="3" Fixed="1" Mandatory="1">
                      <Index>#x1a05</Index>
                      <Name>ActualLocationB</Name>
                      <Entry>
                          <Index>#x6066</Index>
                          <SubIndex>0</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>Input</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </TxPdo>
                  <TxPdo Sm="3" Fixed="1" Mandatory="1">
                      <Index>#x1a07</Index>
                      <Name>ActualVeloA</Name>
                      <Entry>
                          <Index>#x606c</Index>
                          <SubIndex>0</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>Input</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </TxPdo>
                  <TxPdo Sm="3" Fixed="1" Mandatory="1">
                      <Index>#x1a09</Index>
                      <Name>ActualVeloB</Name>
                      <Entry>
                          <Index>#x606e</Index>
                          <SubIndex>0</SubIndex>
                          <BitLen>16</BitLen>
                          <Name>Input</Name>
                          <DataType>UINT16</DataType>
                      </Entry>
                  </TxPdo>
              </Device>
          </Devices>
      </Descriptions>
  </EtherCATInfo>

This is working for me. I dont know the reason. Screenshot from 2023-11-21 18-13-59 Screenshot from 2023-11-21 18-13-37

LRAJA33 commented 9 months ago

Dear friend, kindly share the code for testing.

r2k-in-the-vortex commented 9 months ago

When you got this, I'm sure you were running old code still, the line of code to print that just plain doesn't exist in latest code I linked. image

Fetching new code and rerunning ./install.sh linux ethercat is what probably did the trick. Maybe there was a similar issue earlier why that version of xml with all 16bit registers didn't work the first time, but is now working fine. Well as long as it's working all is good.

Anyway, you now have the slave in OP state, everything running on EtherCAT and OpenPLC end. How to configure the servo drive and write the PLC code to actually move the motor, that's an exercise I'll leave to you. I have never used that particular brand of servo drives before, so I wouldn't know anything about it. I'd start from trying to jog it via usb configuration port, that seems like a reasonable starting point.

LRAJA33 commented 9 months ago

Dear friend, I have done the jog test of servo drive using usb and sd soft software installed on the host machine.

I don't know how to start. But I have controled the servo using codesys ide with function block like Mc_power, Mc_moveabsolute and move relative.

There are a control word status word ,target velocity and target position index register.

If I get on / off code for reference, then I will develop further. Possible kindly help. Else i will try .Really thanks for the kind help and support

On Tue, 21 Nov, 2023, 9:15 pm r2k-in-the-vortex, @.***> wrote:

When you got this, I'm sure you were running old code still, the line of code to print that just plain doesn't exist in latest code I linked. [image: image] https://user-images.githubusercontent.com/30666740/284632038-abc99ff6-45cc-4c45-9850-537fa1c61dee.png

Fetching new code and rerunning ./install.sh linux ethercat is what probably did the trick. Maybe there was a similar issue earlier why that version of xml with all 16bit registers didn't work the first time, but is now working fine so all is good.

Anyway, you now have the slave in OP state, everything running on EtherCAT and OpenPLC end. How to configure the servo drive and write the PLC code to actually move the motor, that's an exercise I'll leave to you. I have never used that particular brand of servo drives before, so I wouldn't know anything about it. I'd start from trying to jog it via usb configuration port, that seems like a reasonable starting point.

— Reply to this email directly, view it on GitHub https://github.com/r2k-in-the-vortex/ethercat_src/issues/5#issuecomment-1821178562, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZCBRFJYH3LMLXY6PKEF7JDYFTEB3AVCNFSM6AAAAAA7BQZF4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRRGE3TQNJWGI . You are receiving this because you authored the thread.Message ID: @.***>

r2k-in-the-vortex commented 9 months ago

Well there is no MC_Power in OpenPLC. But reading status, writing to control register, that you can do easily enough. This is already in the right direction: image

You just need to work through the documentation, what each bit in registers means and experiment with it.

LRAJA33 commented 9 months ago

Hi...the new code only I am getting this error for 32 bit indexing

The new code and old codes are working fine with 16bit indexing. I have tested. Big thanks to you.

On Tue, 21 Nov, 2023, 9:31 pm RAJASEKAR L, @.***> wrote:

Dear friend, I have done the jog test of servo drive using usb and sd soft software installed on the host machine.

I don't know how to start. But I have controled the servo using codesys ide with function block like Mc_power, Mc_moveabsolute and move relative.

There are a control word status word ,target velocity and target position index register.

If I get on / off code for reference, then I will develop further. Possible kindly help. Else i will try .Really thanks for the kind help and support

On Tue, 21 Nov, 2023, 9:15 pm r2k-in-the-vortex, @.***> wrote:

When you got this, I'm sure you were running old code still, the line of code to print that just plain doesn't exist in latest code I linked. [image: image] https://user-images.githubusercontent.com/30666740/284632038-abc99ff6-45cc-4c45-9850-537fa1c61dee.png

Fetching new code and rerunning ./install.sh linux ethercat is what probably did the trick. Maybe there was a similar issue earlier why that version of xml with all 16bit registers didn't work the first time, but is now working fine so all is good.

Anyway, you now have the slave in OP state, everything running on EtherCAT and OpenPLC end. How to configure the servo drive and write the PLC code to actually move the motor, that's an exercise I'll leave to you. I have never used that particular brand of servo drives before, so I wouldn't know anything about it. I'd start from trying to jog it via usb configuration port, that seems like a reasonable starting point.

— Reply to this email directly, view it on GitHub https://github.com/r2k-in-the-vortex/ethercat_src/issues/5#issuecomment-1821178562, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZCBRFJYH3LMLXY6PKEF7JDYFTEB3AVCNFSM6AAAAAA7BQZF4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRRGE3TQNJWGI . You are receiving this because you authored the thread.Message ID: @.***>

LRAJA33 commented 9 months ago

Ok..friend I will check morning whether I have tested in right way. And I will update you

LRAJA33 commented 9 months ago

When you got this, I'm sure you were running old code still, the line of code to print that just plain doesn't exist in latest code I linked. image

Fetching new code and rerunning ./install.sh linux ethercat is what probably did the trick. Maybe there was a similar issue earlier why that version of xml with all 16bit registers didn't work the first time, but is now working fine. Well as long as it's working all is good.

Anyway, you now have the slave in OP state, everything running on EtherCAT and OpenPLC end. How to configure the servo drive and write the PLC code to actually move the motor, that's an exercise I'll leave to you. I have never used that particular brand of servo drives before, so I wouldn't know anything about it. I'd start from trying to jog it via usb configuration port, that seems like a reasonable starting point.

Dear Friend, In veichi servo drive, target position, target velocity index registers are DINT32. In your xml you have mentioned UIN16 , but i have changed DINT16, so only it was not worked for me.

LRAJA33 commented 9 months ago

hi, one small doubt, Can we use STM32 ,i.mx6 or i.mx8 processor in OpenPLC ?if yes how to use the IO access for different board?

r2k-in-the-vortex commented 8 months ago

Hey, OpenPLC can run on all sorts of hardware, but I'm not familiar with most possible lower powered platforms, you would have to search around in documentation and forum for that. This EtherCAT implementation here uses IgH EtherCAT Master, if you can get that running on your hardware and OS, then OpenPLC will be able to use it, if not, I can't really help with that, refer to etherlab.

As for datatypes in xml, this field is cosmetic, ethercat_src handles everything according to bitlen, even if you write a invalid datatype like DINT16 into XML, it doesn't do anything. But you do need to declare a correct size variable in PLC program and more importantly, the correct type of IO location, X, B, W, D or L.

bitlen variable size in EtherCAT frame PLC types PLC IO location
1 1 bit BOOL %IX0.0
8 1 byte SINT, USINT, BYTE %IB0.0
16 2 bytes INT, UINT, WORD %IW0.0
32 4 bytes DINT, UDINT, DWORD, REAL %ID0.0
64 8 bytes LINT, ULINT, LWORD, LREAL %IL0.0
LRAJA33 commented 8 months ago

Thanks for your kind reply.

http://www.bitsathy.ac.in/ Dr RAJASEKAR L | ASP Electronics and Instrumentation Engineering Bannari Amman Institute of Technology Sathyamangalam, Erode - 638 401 https://goo.gl/maps/rkMMcedqLVpzaDEY9 [image: T] +91 96007 66788 <%20+91%2096007%2066788> | 04295 226000 <%2004295%20226000> [image: M] @.***

On Wed, Nov 22, 2023 at 10:26 PM r2k-in-the-vortex @.***> wrote:

Hey, OpenPLC can run on all sorts of hardware, but I'm not familiar with most possible lower powered platforms, you would have to search around in documentation and forum for that. This EtherCAT implementation here uses IgH EtherCAT Master https://gitlab.com/etherlab.org/ethercat, if you can get that running on your hardware and OS, then OpenPLC will be able to use it, if not, I can't really help with that, refer to etherlab.

As for datatypes in xml, this field is cosmetic, ethercat_src handles everything according to bitlen, even if you write a invalid datatype like DINT16 into XML, it doesn't do anything. But you do need to declare a correct size variable in PLC program. bitlen variable size PLC types 1 1 byte BOOL 8 1 byte SINT, USINT, BYTE 16 2 bytes INT, UINT, WORD 32 4 bytes DINT, UDINT, DWORD, REAL 64 8 bytes LINT, ULINT, LWORD, LREAL

— Reply to this email directly, view it on GitHub https://github.com/r2k-in-the-vortex/ethercat_src/issues/5#issuecomment-1823145691, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZCBRFLO2FX43TR2F6HGBG3YFYVD5AVCNFSM6AAAAAA7BQZF4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRTGE2DKNRZGE . You are receiving this because you authored the thread.Message ID: @.***>

LRAJA33 commented 8 months ago

Thanks for your kind reply. I have refered the openplc documentation. Currently, OpenPLC Runtime is officially supported on the following platforms:

Arduino Uno / Nano / Leonardo / Micro Arduino Mega / Due Arduino Nano Every / IoT / BLE Arduino RB2040 Connect Arduino Mkr / Zero / WiFi Arduino Pro (Machine Control and EDGE) Controllino Maxi / Automation / Mega / Mini Productivity Open P1AM ESP8266 (nodemcu) ESP32 Raspberry Pi 2 / 3 / 4 PiXtend UniPi Industrial Platform Neuron PLC FreeWave Zumlink FreeWave ZumIQ Windows (generic target as a soft-PLC) Linux (generic target as a soft-PLC)

PHYSICAL ADDRESSING are give for the above hardware's only. Screenshot from 2023-11-22 22-53-03

suppose if i use the i.mx6 type of hardware, how to do the PHYSICAL ADDRESSING?

r2k-in-the-vortex commented 8 months ago

As of right now, ethercat_src is only compatible with OpenPLC hardware platform Linux (generic target as a soft-PLC)

That+ethercat is what you select when you install OpenPLC with option ./install.sh linux ethercat

It of course means the local IO of raspberry will not work at the same time with ethercat. It could be done by shifting EtherCAT IO so they wouldn't conflict with local IO, figuring out all the correct install scripts of OpenPLC etc, but it hasn't been done. If you wish, you are welcome to fork the repo and have a go at it, but maybe its easier to just get some ethercat IO modules.

If you wish to use local IO with OpenPLC on some unsupported platform, then you have to write the support for that platform. You can find the examples under hardware layers

LRAJA33 commented 8 months ago

Dear Friend, I was unable to make it work. I have used the xml shared by you `============================

8716548 SD700_ECAT Drive #x1601 2nd Recive PDO Maping #x6040 0 16 ControlRegister UINT16 #x1603 TargetPos #x607a 1 32 Output UINT32 #x1607 TargetVelo #x60ff 1 32 Output UINT32 #x1a01 2nd Send PDO Maping #x6041 0 16 StatusRegister UINT16 #x1a03 ActualLocation #x6064 0 32 Input UINT32 #x1a07 ActualVelo #x606c 0 32 Input UINT32

=================================` I have pull out the git. it says it was upto date., but related /modified files for 32 bit not updated. So i have copy and paste the files (ethercat_src.c, ethercat_src.h,main.c and files in the ethercat handler)

There is no error, but slave in PREOP state always. and after some time "socket error coming on the rpi terminal, and run time logs are gone with empty.I cant able to find the issues. kindly check and do the needful

Screenshot from 2023-12-07 17-07-51

Screenshot from 2023-12-07 17-13-44