Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EtherCAT connection with OpenPLC and Raspberry Pi #5

Open
LRAJA33 opened this issue Nov 7, 2023 · 139 comments
Open

EtherCAT connection with OpenPLC and Raspberry Pi #5

LRAJA33 opened this issue Nov 7, 2023 · 139 comments

Comments

@LRAJA33
Copy link

LRAJA33 commented Nov 7, 2023

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
Copy link
Owner

r2k-in-the-vortex commented Nov 8, 2023

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
Copy link
Author

LRAJA33 commented Nov 8, 2023

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
Copy link
Owner

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
Copy link
Owner

r2k-in-the-vortex commented Nov 10, 2023

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
Copy link
Author

LRAJA33 commented Nov 14, 2023

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
Copy link
Owner

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
Copy link
Owner

r2k-in-the-vortex commented Nov 15, 2023

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
Copy link
Owner

r2k-in-the-vortex commented Nov 15, 2023

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
Copy link
Author

LRAJA33 commented Nov 16, 2023

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
Copy link
Owner

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
Copy link
Author

LRAJA33 commented Nov 16, 2023

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
Copy link
Author

LRAJA33 commented Nov 16, 2023

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
Copy link
Owner

r2k-in-the-vortex commented Nov 16, 2023

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
Copy link
Owner

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

Recording.2023-11-16.214705.mp4

@LRAJA33
Copy link
Author

LRAJA33 commented Nov 17, 2023

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
Copy link
Owner

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
Copy link
Author

LRAJA33 commented Nov 18, 2023

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
Copy link
Author

LRAJA33 commented Nov 18, 2023

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
Copy link
Owner

r2k-in-the-vortex commented Nov 19, 2023

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
Copy link
Author

LRAJA33 commented Nov 19, 2023

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
Copy link
Owner

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
Copy link
Author

LRAJA33 commented Nov 19, 2023

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
Copy link
Owner

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

@LRAJA33
Copy link
Author

LRAJA33 commented Nov 19, 2023

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
Copy link
Owner

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
Copy link
Author

LRAJA33 commented Nov 19, 2023

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
Copy link
Owner

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
Copy link
Author

LRAJA33 commented Nov 19, 2023

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
Copy link
Owner

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
Copy link
Author

LRAJA33 commented Nov 19, 2023

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

@r2k-in-the-vortex
Copy link
Owner

yes, 3rd PDO mapping is only velocity control

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 17, 2024

Ok..friend i will modify it.

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 17, 2024

What else wee need to check/verify before the PLC part?

@r2k-in-the-vortex
Copy link
Owner

The xml file first, then the sdo config script https://github.com/LRAJA33/OpenPLC_EtherCAT/blob/main/servo_drive_sdo_config.sh

Because that script has to match what PDO mapping you want to use right? There are still some errors there, for example:
sudo ethercat download -p 0 -t uint16 0x1A00 1 0x60410010

you say you want to download uint16, but then you give it a 32 bit value.

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 17, 2024

No friend. The modified script file is in my college system. I will update it on Monday. Its 32 only and i have used 32 only not 16

@r2k-in-the-vortex
Copy link
Owner

r2k-in-the-vortex commented Feb 17, 2024

Right, then lets check it on Monday, but everything 32 is also not good, for example at the end of the script you have 16 and 8 bit values, that's just wrong if you download 32 bit value to them.

The datatype has to match the register size. 8 bit to 8 bit, 16 to 16 and 32 to 32

That's why I'm saying, don't jump ahead, go through every step carefully and double check that you have done everything right. A mistake in the beginning makes success at the end impossible.

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 17, 2024

Yes friend. not all 32 bit. I shared previously have look. I will double check, Modify and test all the things and update you on Monday

#!/bin/bash

# Start EtherCAT
sudo systemctl start ethercat

# Set EtherCAT state to PREOP
sudo ethercat states preop

# Wait for 3 seconds
sleep 3

# EtherCAT SDO Configuration
sudo ethercat download -p 0 -t uint8 0x1C12 0 0
sudo ethercat download -p 0 -t uint8 0x1C13 0 0
sudo ethercat download -p 0 -t uint8 0x1A00 0 0
sudo ethercat download -p 0 -t uint16 0x1A00 1 0x6041
sudo ethercat download -p 0 -t uint32 0x1A00 2 0x6064
sudo ethercat download -p 0 -t uint16 0x1A00 3 0x60B9
sudo ethercat download -p 0 -t uint32 0x1A00 4 0x60BA
sudo ethercat download -p 0 -t uint32 0x1A00 5 0x60FD
sudo ethercat download -p 0 -t uint8 0x1A00 0 0x05

sudo ethercat download -p 0 -t uint8 0x1A01 0 0
sudo ethercat download -p 0 -t uint16 0x1A01 1 0x6041
sudo ethercat download -p 0 -t uint16 0x1A01 2 0x6040
sudo ethercat download -p 0 -t uint32 0x1A01 3 0x606C
sudo ethercat download -p 0 -t uint8 0x1A01 0 0x03

sudo ethercat download -p 0 -t uint8 0x1A02 0 0
sudo ethercat download -p 0 -t uint16 0x1A02 1 0x6041
sudo ethercat download -p 0 -t uint16 0x1A02 2 0x6040
sudo ethercat download -p 0 -t uint32 0x1A02 3 0x606C
sudo ethercat download -p 0 -t uint8 0x1A02 0 0x03

sudo ethercat download -p 0 -t uint8 0x1A03 0 0
sudo ethercat download -p 0 -t uint16 0x1A03 1 0x6041
sudo ethercat download -p 0 -t uint32 0x1A03 2 0x6064
sudo ethercat download -p 0 -t uint32 0x1A03 3 0x6077
sudo ethercat download -p 0 -t uint8 0x1A03 0 0x03

sudo ethercat download -p 0 -t uint8 0x1600 0 0
sudo ethercat download -p 0 -t uint16 0x1600 1 0x6040
sudo ethercat download -p 0 -t uint32 0x1600 2 0x607A
sudo ethercat download -p 0 -t uint32 0x1600 3 0x6060
sudo ethercat download -p 0 -t uint16 0x1600 4 0x60B8
sudo ethercat download -p 0 -t uint8 0x1600 0 0x04

sudo ethercat download -p 0 -t uint8 0x1601 0 0
sudo ethercat download -p 0 -t uint16 0x1601 1 0x6040
sudo ethercat download -p 0 -t uint32 0x1601 2 0x607A
sudo ethercat download -p 0 -t uint32 0x1601 3 0x60FF
sudo ethercat download -p 0 -t uint8 0x1601 0 0x03

sudo ethercat download -p 0 -t uint8 0x1602 0 0
sudo ethercat download -p 0 -t uint16 0x1602 1 0x6040
sudo ethercat download -p 0 -t uint32 0x1602 2 0x60FF
sudo ethercat download -p 0 -t uint8 0x1602 0 0x02

sudo ethercat download -p 0 -t uint8 0x1603 0 0
sudo ethercat download -p 0 -t uint16 0x1603 1 0x6040
sudo ethercat download -p 0 -t uint32 0x1603 2 0x6071
sudo ethercat download -p 0 -t uint8 0x1603 0 0x02

sudo ethercat download -p 0 -t uint16 0x1C12 1 0x1601
sudo ethercat download -p 0 -t uint8 0x1C12 0 0x01
sudo ethercat download -p 0 -t uint16 0x1C13 1 0x1A01
sudo ethercat download -p 0 -t uint8 0x1C13 0 0x01

sudo ethercat download -p 0 -t uint8 0x6060 0 8
sudo ethercat download -p 0 -t uint16 0x60C2 1 0x04
sudo ethercat download -p 0 -t uint16 0x60C2 2 0xFD


# Set EtherCAT state to OP
sudo ethercat states op

# Wait for 3 seconds
sleep 3

@r2k-in-the-vortex
Copy link
Owner

are you entirely clear on variable sizes?

0x00 is 8 bits
0x0000 is 16 bits
0x00000000 is 32 bits

just mentioning so that there is no confusion.

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 17, 2024

Ok.Friend...got it I will make the changes and update you

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 19, 2024

Dear friend,
I have updated the servo drive sdo configuration file (servo_sdo_config.sh) in github.

I have discussed with Veichi technical person regarding, the use of 1st pdo mapping for velocity control. They replied that we can use it for velocity control and shared this image. kindly check and clarify.
IMG-20240219-WA0001

@r2k-in-the-vortex
Copy link
Owner

Alright, the datatypes and variable sizes make sense now, but how did you generate values?

if we look at following:

sudo ethercat download -p 0 -t uint32 0x1A00 1 0x60410010
sudo ethercat download -p 0 -t uint32 0x1A00 2 0x60640020
sudo ethercat download -p 0 -t uint32 0x1A00 3 0x60B90010
sudo ethercat download -p 0 -t uint32 0x1A00 4 0x60BA0020
sudo ethercat download -p 0 -t uint32 0x1A00 5 0x60FD0020
sudo ethercat download -p 0 -t uint8 0x1A00 0 0x05

I think the interpretation of it here is:
1st item of 1a00 pdo is 6041 (Status word)
2nd item is 6064 (Actual position)
3rd item is 60b9 (touch probe status!) that's not what you have in xml, it doesn't match. This is what you would have in case of the default mapping of 1a00, but you have modified mapping.

in twincat I can create this modified mapping as in your xml

image

image

but the startup list that it produces is different, because of course it is. The xml configures the master, the SDO download list configures the drive, those two have to match.

please make it match

image

@r2k-in-the-vortex
Copy link
Owner

r2k-in-the-vortex commented Feb 19, 2024

Hmmzz..... actually, if I delete all the alternative mappings that aren't even used

image

then the startup list gets a lot shorter

image

So maybe only that part is truly necessary, have to try.

@r2k-in-the-vortex
Copy link
Owner

I think you also have to check what mode of operation you are using, the default mode 8 is csp

image

but that mode uses different registries than what you have mapped

image

maybe you should pick a different mode of operation, for example csv
image

or pv
image

because you only have 60ff mapped to control the motion

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 20, 2024

Dear Friend,

Thanks for the detailed information. I will follow the SDO configuration as suggested by you. From the diagrammatic representation of mode of operation, My understanding is that its enough to transmit the target velocity 0x60FF from PLC code for run the servo drive (in csv mode). Is it right?

PLC code (csv mode)

Operating_Mode := 3;
Target_Velocity := 1000;

@r2k-in-the-vortex
Copy link
Owner

Yes, except that csv mode is no 9 not no 3.

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 20, 2024

Ok...friend. I will try and update you. Thanks

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 22, 2024

Dear Friend,

Finally it is over. I have ran the servo successfully in velocity mode. Thanks lots for your kind support.:) :) :) 👍

@r2k-in-the-vortex
Copy link
Owner

r2k-in-the-vortex commented Feb 22, 2024

Heh, now that took some time and effort, I'm glad you finally got it running.

Do you mind maybe uploading a short clip on youtube to show off your running servo? I think you are likely the very first to run such a servo using OpenPLC.

If anyone has run any servos using OpenPLC, they have been much simpler types, nothing as complex as an ethercat drive.

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 23, 2024

Dear Friend,

Thanks with all your support. Yes. I will prepare the video and share the video link. Thanks

@LRAJA33
Copy link
Author

LRAJA33 commented Feb 23, 2024

@r2k-in-the-vortex
Copy link
Owner

Nice job, very well done.

@LRAJA33
Copy link
Author

LRAJA33 commented Mar 12, 2024

Dear friend, How are you? I need one small help.

I am trying to configure the "Cyclic Synchronous Position" mode. It is rotating. But un able to continuously run the servo. these lines are included in the code

" FOR i := 1 TO 10 DO
Target_position := Target_position + 200;
END_FOR;"

Upto count value 10, the motor moves.
When i am trying to increase the count from 10 to 20 . servo is not moving

How to configure the servo? when i am giving 360 as target position, it will rotate one rotation. My servo encoder is 17 bit resolution. Absolute type.

kindly check the video https://drive.google.com/file/d/1Wnl1woR-tUmICFYhO9x4_T6B0I7P30Ej/view?usp=drive_link(Edited)

@LRAJA33
Copy link
Author

LRAJA33 commented Mar 12, 2024

Hi..friend , I can easily write the values to target_position and target_velocity. But how to read the actual_velocity and actual_position ?

*ptr = EC_READ_U32(domain1_pd + pdo.offset);

How to use this to read the actual position and velocity?

@r2k-in-the-vortex
Copy link
Owner

FOR i := 1 TO 10 DO
Target_position := Target_position + 200;
END_FOR;

That code is equivalent to doing:
Target_position := Target_position + 2000;
If you increase too much it probably goes to lag error or something, this is drive specific, you got to dig it's documentation and maybe there is some configuration software for that drive. It has a USB port for that, configure it and read what the error codes are etc.

the Actual_Velocity variable in your program already reads the actual velocity, you have set it up previously and configured the drive to report it, so it already exists at %ID2.0 address, you just use it in your plc program as is.

as for actual position you have it configured at %ID1.0

image

@LRAJA33
Copy link
Author

LRAJA33 commented Mar 13, 2024

Ok..friend. I will check it

@LRAJA33
Copy link
Author

LRAJA33 commented Mar 14, 2024

Hi...How to adjust the cycle time in the source code.? how to calculate the cycle time? based on this , we will provide position control pulses. kindly check and help

@r2k-in-the-vortex
Copy link
Owner

I would expect that one to work, but if not then I have no idea, haven't needed to do that.

image

@LRAJA33
Copy link
Author

LRAJA33 commented Mar 18, 2024

Dear Friend,

Thanks. I will check it out.

@LRAJA33
Copy link
Author

LRAJA33 commented May 14, 2024

Dear Friend,
How are you? Need one clarification on ecat_handler.c code. What would be replaced by this command? simple delay or something.
Your suggestion is required.

"// for some mysterious reason writing data too early prevents slaves responding correctly
// needs a better fix in future"

ecat_cyclic

@r2k-in-the-vortex
Copy link
Owner

Check the init_done flag, right now it waits for either WC_COMPLETE state, or 500 incomplete cycles, which is half a second at 1ms cycle. And this is operative only at startup.

Does it cause any problems? If not, then it's good enough. If it does, then it's necessary to investigate in more detail.

This has been there all the way from 2022, I don't even remember what the issue was if it was not there. It would have to be tested and investigated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants