python-can icon indicating copy to clipboard operation
python-can copied to clipboard

esdcan

Open ghost opened this issue 7 years ago • 5 comments

Could python-can support the esdcan interface? And what's the interface name?

ghost avatar Sep 14 '18 01:09 ghost

The interface name is generally just a well memorable short string. Generally, extensions could be written for almost any type of interface. You are very welcome to contribute it, and we will help you get started if you want to. Until then, I will close this issue.

felixdivo avatar Feb 11 '19 19:02 felixdivo

I've had need to write a driver for ESD's CAN cards utilising their provided python bindings.

It's not in any way ready for PR, but feedback on it would be appreciated, especially regarding the limitation ESD seems to add to their timeouts?

(For reference, the SDK in question is available here: https://esd.eu/en/products/can-sdk)

See this gist for the driver as written: https://gist.github.com/DanseMacabre/60f26aa4abed4d4b3bb8a9aacf439fd1

@felixdivo What sort of changes etc would be required to get this set up for PR (beyond documentation and setting it up so it can fail gracefully on a system without ESD's NTCAN set up properly)? Should this issue be re-opened or a new issue created referencing this?

DanseMacabre avatar Mar 04 '19 14:03 DanseMacabre

I am currently a bit short of time. But you could open a PR and I could tag it as "work in progress". It will probably get some attention from others as well so we can work on this together.

But I just wanted to link these two sources for you https://python-can.readthedocs.io/en/stable/development.html#creating-a-new-interface-backend https://python-can.readthedocs.io/en/stable/internal-api.html#businternals But it seems like you have already followed it. 😄

As for the name of the interface, both esdcan and ntcan seem OK, I guess this is subjective.

At the end, you can also leave a note in python-can/doc/history.rst.

Some first feedback:

  • self.RxQS = 2000 (and alike, as well as self.CIF) should be lowercase with underscores, see PEP8.
  • _recv_internal should only return True as a second parameter if filtering actually took place. Else return False to let the superclass fall back to software filtering.
  • Could _recv_internal also pass is_extended_id as a parameter to the message constructor?

I did not have a look at the docs from esd GmbH, are they available somewhere else more freely?

felixdivo avatar Mar 04 '19 20:03 felixdivo

I do believe the only place to get the docs is ESD GmbH. The docs are "free" to download, and only requires an account on their website to access. The latest revision available is revision 5.2 on ESD GmbH. A revision 4.3 is available from their US (branch?) here: http://www.esd-electronics-usa.com/Shared/Docu/CANPCI400/CAN-API_Part1_Function_Manual_43.pdf . The differences seem to be largely CAN-FD related things, along side a couple of new features such as timestamped messages etc.

In addition, however the documentation (examples, rather than documentation!) for the python bindings is quite severely lacking and is located under My Documents "ESD\CANscript\scripts" post installation of the ESD CAN-SDK.

Installing the Python bindings in a VENV is a bit less easy due to the distribution of the bindings in an EXE format, however following the instructions here it is possible: https://stackoverflow.com/a/20324555.

Perhaps we should go to ESD's offices and beg for some common sense :sob:

DanseMacabre avatar Mar 05 '19 11:03 DanseMacabre

For the record, PyNTCAN is now shared as wheel files for python 3.10 and 3.11, in their CAN SDK (C:\Program Files\ESD\CAN\SDK\lib\Python) installation.

gohierf avatar Feb 01 '24 11:02 gohierf