DBC to RealDash CAN XML Converter (WIP)

Got fed up trying to hand copy definitions I already have in DBC over to realdash format.

I have written a converter that will do this automatically. I’ve tested on some files I have, and seems OK for most cases. Seems to do a good job with the 301 signals in the full MegaSquirt DBC. No multiplexing as yet, I’ll get to it eventually

  • Output files are saved in the DBC path.


  • In theory it should work with DBC, KCD, SYM, ARXML 4 and CDD formats


  • USAGE python .\DBCtoRD-convert.py “C:/example/path/” “demo.dbc”


  • Requires python3 + cantools (pip install cantools)

https://github.com/wjcloudy/DBCtoRDXML

Hopefully this is useful to others & feel free to contribute improvements to the repo :sunglasses:

2 Likes

Added support for realdash enumerated values where lookups exist in the DBC. It will create a second signal with suffix _enum. Also moved to bitstart and bit count rather than offset and length. This should allows signals that overlap partial bytes.
@jani -I wasn’t sure if there was a way to have enumerated values in the same signal (and then just have realdash allow choice of numerical or lookup values) can you confirm?

ie:

<value name="ver1-IMD_Response_IG_VIFC_IMC_ALIVE" startbit="8" bitcount="16" units="None" endianess="little" signed="false" rangeMin="None" rangeMax="None" conversion="V"></value><!--Comment=None-->
<value name="ver1-IMD_Response_IG_VIFC_IMC_ALIVE_enum" startbit="8" bitcount="16" units="None" endianess="little" signed="false" rangeMin="None" rangeMax="None" conversion="V" enum="100:Unknown,2:OutOfRange,1:Error,0:Running,#:err"></value><!--Comment=None-->

Very nice, thank you for sharing!

Thanks so much for attempting this. I just wanted to let you know i did try converting a DBC file from the below link.

Unfortunately nothing works in realdash. I dont think its your script, its the DBC file is not formatted in a way to link up with the Realdash target ids.

https://github.com/dzid26/opendbc-BMW-E8x-E9x/find/master

Thanks for the software regardless.

If I am understanding your issue - It won’t link to default built in realdash IDs like RPM/speed etc (too many permutations to know what part of your DBC should go to which!) They all come in as custom (named from the DBC) values - you just need to choose the those data channels for each gauge by editing the dash… (Or just tweak the XML file once converted to change <value name=“” to <value targetId=“” for the signals you want attached to the default ones in RD)

I was only able to install cantools on Linux.
How do I run? it returns this message:

usage: DBCtoRD-convert [-h] path filename
DBCtoRD-convert: error: the following arguments are required: path, filename

Supply it with a path and filename. ie:

python .\DBCtoRD-convert.py “C:/example/path/” “demo.dbc”

Try again, like this:

parser.add_argument("/home/realdash", help="The path for the DBC ie: c:/this/path/", type=str)
parser.add_argument("demo.dbc", help="The filename for conversion ie: demo.dbc", type=str)

returns this message:

usage: DBCtoRD-convert [-h] /home/realdash demo.dbc
DBCtoRD-convert: error: the following arguments are required: /home/realdash,  demo.dbc

Just stumbled upon this, was multiplexing support ever completed? if not, I’ll dig in soon to try to complete it.

I starred this a while ago on Github, but I just tried it out. So far it’s working great and is saving me lots of time.
Thank You!

1 Like