tecki / ebpfcat Goto Github PK
View Code? Open in Web Editor NEWA Python-base EBPF code generator
License: GNU General Public License v2.0
A Python-base EBPF code generator
License: GNU General Public License v2.0
Hi,
Sorry to keep bothering you. π
I have 4 slaves on the ek1100. They are el1088, el1088, el2088, el2088 in order.
with your ethercat.py in the example. i can get 5 slaves.
I have two EL1088 and two EL2088 each. How should I write my program code to control them ? π΅
print("Number of terminals:", await master.count()) out = EL4104(master) await out.initialize(-2, 20)
EasyCAT HAT is a ethercat slave for raspberry pi.
this slave is here EasyCAT and its ESI/XML
this slave can share 32 bytes for output(from slave, master read only) , 32byte for input(from master,slave read only).
I have try to define a slave into terminals.py :
class EASYCAT3232(EBPFTerminal):
compatibility = {(0x0000079A, 0x00DEFEDE)}
byte0 = ProcessDesc(0x0005, 1, 'B')
byte1 = ProcessDesc(0x0005, 2, 'B')
byte2 = ProcessDesc(0x0005, 3, 'B')
byte3 = ProcessDesc(0x0005, 4, 'B')
byte4 = ProcessDesc(0x0005, 5, 'B')
byte5 = ProcessDesc(0x0005, 6, 'B')
byte6 = ProcessDesc(0x0005, 7, 'B')
byte7 = ProcessDesc(0x0005, 8, 'B')
byte8 = ProcessDesc(0x0005, 9, 'B')
byte9 = ProcessDesc(0x0005, 10, 'B')
byte10 = ProcessDesc(0x0005, 11, 'B')
byte11 = ProcessDesc(0x0005, 12, 'B')
byte12 = ProcessDesc(0x0005, 13, 'B')
byte13 = ProcessDesc(0x0005, 14, 'B')
byte14 = ProcessDesc(0x0005, 15, 'B')
byte15 = ProcessDesc(0x0005, 16, 'B')
byte16 = ProcessDesc(0x0005, 17, 'B')
byte17 = ProcessDesc(0x0005, 18, 'B')
byte18 = ProcessDesc(0x0005, 19, 'B')
byte19 = ProcessDesc(0x0005, 20, 'B')
byte20 = ProcessDesc(0x0005, 21, 'B')
byte21 = ProcessDesc(0x0005, 22, 'B')
byte22 = ProcessDesc(0x0005, 23, 'B')
byte23 = ProcessDesc(0x0005, 24, 'B')
byte24 = ProcessDesc(0x0005, 25, 'B')
byte25 = ProcessDesc(0x0005, 26, 'B')
byte26 = ProcessDesc(0x0005, 27, 'B')
byte27 = ProcessDesc(0x0005, 28, 'B')
byte28 = ProcessDesc(0x0005, 29, 'B')
byte29 = ProcessDesc(0x0005, 30, 'B')
byte30 = ProcessDesc(0x0005, 31, 'B')
byte31 = ProcessDesc(0x0005, 32, 'B')
Refer to your devices.py, I don't know what kind of device it should be.
As following code. Please tell me how to modify the following program to read the value of byte0 and write the value to byte1? π΅ DigitalOutput -> ???
easycat = EASYCAT3232(master)
await easycat.initialize(-5,21)
do1 = DigitalOutput(out1.channel1) # use channel 1 of terminal "out"
do2 = DigitalOutput(out2.channel3) # use channel 1 of terminal "out"
Hi, I install new one(RPI4, python3.11).This message will appear as soon as I execute the program.
This program i can run in the old one(RPI3, python3.9). What problem do you think this might be ?
Exception in callback EtherCat.connection_made(<_SelectorDat...e, bufsize=0>>)
handle: <Handle EtherCat.connection_made(<_SelectorDat...e, bufsize=0>>)>
Traceback (most recent call last):
File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/jinyistudio/python/ebpfcat/ebpfcat/lib/python3.11/site-packages/ebpfcat/ethercat.py", line 451, in connection_made
transport.get_extra_info("socket").bind(self.addr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TransportSocket' object has no attribute 'bind'
Exception in callback XDRFD.connection_made(<_SelectorDat...e, bufsize=0>>)
handle: <Handle XDRFD.connection_made(<_SelectorDat...e, bufsize=0>>)>
Traceback (most recent call last):
File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/home/jinyistudio/python/ebpfcat/ebpfcat/lib/python3.11/site-packages/ebpfcat/xdp.py", line 61, in connection_made
sock.bind((0, 0))
^^^^^^^^^
AttributeError: 'TransportSocket' object has no attribute 'bind'
How to use ebpfcat to access an ethercat slave(EasyCAT) with python?
https://www.bausano.net/en/hardware/ethercat-and-raspberry.html
EasyCAT ESI file
https://www.bausano.net/images/arduino-easycat/EasyCAT.xml
Hi,
Sorry, can you give me a sample program to teach me how to use SyncManager ?
I refer to ESI/XML to midify old class to as following.
class EASYCAT32(EBPFTerminal):
compatibility = {(1946, 14614238)}
# input PDO
input0 = PacketDesc(1, 0,'B')
input1 = PacketDesc(1, 1,'B')
input2 = PacketDesc(1, 2,'B')
input3 = PacketDesc(1, 3,'B')
input4 = PacketDesc(1, 4,'B')
input5 = PacketDesc(1, 5,'B')
input6 = PacketDesc(1, 6,'B')
input7 = PacketDesc(1, 7,'B')
# output PDO
output0 = PacketDesc(0, 0,'B')
output1 = PacketDesc(0, 1,'B')
output2 = PacketDesc(0, 2,'B')
output3 = PacketDesc(0, 3,'B')
output4 = PacketDesc(0, 4,'B')
output5 = PacketDesc(0, 5,'B')
output6 = PacketDesc(0, 6,'B')
output7 = PacketDesc(0, 7,'B')
Sorry, I really donβt know how to use the SyncManager you mentioned?
Can you please teach me how to write a program. Let output1 = input2 π΅π΅
Can you share a little example about hoe to scan devices in the bus ? π΅
i have test your sample
from ebpfcat.ebpfcat import FastEtherCat
master = FastEtherCat("eth0")
await master.connect()
await master.scan_bus()
but i get following message π΅
python ebpfcat1.py
File "/home/jinyistudio/python/ebpfcat1.py", line 6
await master.connect()
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: 'await' outside function
description as title, How to input following network port name if it can run in windows10 ?
master = FastEtherCat("eth0")
await master.connect()
di1 = DigitalInput(in1.channel1) # use channel 1 of terminal "out"
di2 = DigitalInput(in2.channel1) # use channel 1 of terminal "out"
do1 = DigitalOutput(out1.channel1) # use channel 1 of terminal "out"
do2 = DigitalOutput(out2.channel2) # use channel 1 of terminal "out"
ob0 = AnalogOutput(easycat.outputs.byte0)
ob1 = AnalogOutput(easycat.outputs.byte3)
ib1 = AnalogInput(easycat.inputs.byte13)
sg = SyncGroup(master, [di1,di2,do1,do2,ob1,ob0,ib1]) # this sync group only contains one terminal
What can be operated on above is not a single bit/Digital or a single number/Analog. Is it possible to process an array of values?
For example:
ob2 = BufferOutput(easycat.outputs)
ib2 = BufferInput(easycat.inputs)
sg = SyncGroup(master, [ob2,ib2])
ob2.value[0] = 12
ob2.value[1] = 13
n1 = ib2.value[2]
they are OK to access by byte
class EL2088b(EBPFTerminal):
compatibility = {(2, 0x08283052)}
class Channel(Struct):
byte = ProcessDesc(0x7000, 1,'B')
buffer = Channel(0)
class EL2088b(EBPFTerminal):
compatibility = {(2, 0x08283052)}
byte = ProcessDesc(0x7000, 1,'B')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.