christoph2 / pyxcp

ASAM XCP in Python
http://pyxcp.rtfd.org
GNU Lesser General Public License v3.0
197 stars 63 forks source link

Help #143

Open aaroniza0 opened 10 months ago

aaroniza0 commented 10 months ago

Hello,

I'm a senior computer engineering student working on my senior design project at the moment, my project requires reading some hardware through ethernet and the hardware lists xcp on udp/ip as the communication protocol.

My team has to use a raspberry pi, would this library achieve this and work on the pi? If so, how would I install it on my raspberry pi?

I'm new to reading github docs so I apologize if the answer is right in front of me.

Thanks,

aaroniza0

aaroniza0 commented 10 months ago

I'm looking at the xcp_skel.py script in the main branch but how and what would I send to pull data off of a daq?

JavierCorado commented 10 months ago

Considering that you have a Raspberry Pi enabled as an XCP slave device, you can use the Master interface. To my knowledge, pyXCP uses an abstract factory design pattern where you can do the following to use the ethernet transport layer via UDP:

from pyxcp.master import Master
xcp = Master("eth", {"HOST": "<slave_ip_address>", "PORT": <slave_port>, "PROTOCOL": "UDP"})

From there you can use the XCP commands as documented in: Vector's reference manual

The library already has support for: connect, disconnect short download and download (For writing values), and short upload and upload (For reading values).

Note: These commands are for polling data only (CTO messages), this will not retrieve anything from DAQ (DTO messages), perhaps @christoph2 has more input on this.

To further understand the library you can review Vector's documentation and take a look into the Master and Eth transport layers.