ebroecker / canmatrix

Converting Can (Controller Area Network) Database Formats .arxml .dbc .dbf .kcd ...
BSD 2-Clause "Simplified" License
929 stars 400 forks source link

EDS to DBC #488

Open madshadsen opened 4 years ago

madshadsen commented 4 years ago

Hi there,

I was wondering if you've considered adding an EDS to DBC converter for use with CANopen EDS files? I think it would be really helpful for many users!

ebroecker commented 4 years ago

Thanks for this hint. But I have absolute no idea about canopen. So some external help would be needed.

mrfrenzy commented 3 years ago

This would be a really useful feature to have as EDS-files are so widespread with a lot of hardware. The file specification is well documented and free to download https://www.can-cia.org/can-knowledge/canopen/cia306/#

mtslab commented 2 years ago

If you guys figure out how to do this I will love to see it. I don't know why companies bother on writing EDS files if the standard is dbc.

ebroecker commented 1 year ago

I looked a bit into EDS but I'm not really able to understand how they work and how this could be translated to dbc.

Can someone provide some basic example?

mrfrenzy commented 1 year ago

It is great if you want to look at the possibility of implementing this, I will help any way I can. Here is a basic example. Bürkert makes a motor valve called 3280. You can send an opening percentage 0-100% via CAN and it will open this much. It will also respond back with how much it is actually open, the current operating status and if there are any problems.

To aid communication they supply an EDS file with a lot of information. Most CANopen devices support NMT, SDO and PDO. Network Management are used for device status. Service Data Objects are used for programming. Process Data Objects are used for communication and starts transmitting as soon as the device is powered up.

To make the example easy let's start with PDO only. Opening the EDS file in any EDS viewer we can see what PDOs are supported automatically: Transmit and receive PDO (this can be changed with SDO configuration, but let's not worry about that to begin with).

Receive PDO 1 is a communication object the slave RECEIVES from our master. It has two parameters: CMDdigital and PVdigital. Receive PDO 2 is a communication object the slave RECEIVES from our master. It has one parameter: SPDigital Transmit PDO 1 is a communication object the slave SENDS to our master. It has two parameters: CMD and CMD_Disp etc.

I have made a dbc file with the most important objects as an example, I attach this, the EDS file and a PDF file describing the contents. As you can see all the data in my dbc file can be derived from the EDS file.

BUER328X_1_14.eds.zip MA3280-EDS-file-EU-ML.pdf Burkert 3280 dbc.zip

ebroecker commented 1 year ago

Hi @mrfrenzy

Thank you for these details, this will help a lot!

Next I'll build some basic code example

ebroecker commented 1 year ago

Hi @mrfrenzy,

I assembled some code. As far as I understood, the arbitration-ids are dependent from the node_id.

So my code create this dbc with node_id 1:

MotorValve.dbc.zip

you can even test the code: pip install git+https://github.com/ebroecker/canmatrix/tree/eds_support_488

AIRicky commented 1 year ago

Hi there,

I was wondering if you've considered adding an EDS to DBC converter for use with CANopen EDS files? I think it would be really helpful for many users!

Hi there,

Do you know how to convert a DBC file to EDS?

Best, Ricky

FerrariX commented 1 year ago

https://github.com/ebroecker/canmatrix/tree/eds_support_488

Hi,

I'm getting a fatal error of repository not found.

output from running 'pip install git+https://github.com/ebroecker/canmatrix/tree/eds_support_488'

fatal: repository 'https://github.com/ebroecker/canmatrix/tree/eds_support_488/' not found error: subprocess-exited-with-error

I've also tried running 'pip install git+https://github.com/ebroecker/canmatrix#egg=canmatrix[eds]' but still got error testing the posted 'BUER328X_1_14.eds' file.

Update: I was able to get it to install using 'pip install -U git+https://github.com/ebroecker/canmatrix.git@eds_support_488' Unfortunately, it gave me the following errors when I ran 'canconvert BUER328X_1_14.eds test.dbc':

ldf is not supported xls is not supported xlsx is not supported yaml is not supported eds is not supported INFO - convert - Importing BUER328X_1_14.eds ... ERROR - init - This file format is not supported for reading INFO - convert - done

INFO - convert - Exporting test.dbc ... Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code ....

Thanks

ebroecker commented 1 year ago

Hi @FerrariX ,

sorry for the maybe wrong link. You managed to find a working link for checkout.

I forgot to tell: you need the module canopen also. so could you try a pip install canopen and try again?

danjhunter commented 1 year ago

Hi there, I was wondering if you've considered adding an EDS to DBC converter for use with CANopen EDS files? I think it would be really helpful for many users!

Hi there,

Do you know how to convert a DBC file to EDS?

Best, Ricky

Is it possible to convert a .DBC file to .EDS file with this branch @ebroecker? Specifically could you add ability to write .EDS format? Thanks

ebroecker commented 1 year ago

@danjhunter

Sorry - only Basic Support to decode EDS - encoding maybe not possible, i think dbc lacks needed information for this task