generating dbc file for obd2 fails
nandra opened this issue · 2 comments
I'm trying to generate code for this dbc file: https://canlogger1000.csselectronics.com/files/guides/mdf-intro/OBD2-DBC-MDF4.zip (CSS-Electronics-OBD2-Extended-v1.4.dbc) but if fails first with:
go run go.einride.tech/can/cmd/cantool generate `pwd` `pwd` > out.txt
cantool: error: failed to parse DBC source file: /home/marek/CSS-Electronics-OBD2-Extended-v1.4.dbc:190:28: invalid multiplexer value (parse), try --help
exit status 1
which point to the line:
SG_ ParameterID_Service01 m1M : 23|8@0+ (1,0) [0|255] "" Vector__XXX
by replacing m1M
to m1
only it seems to generate code but generation fails with go generated output and at the end:
: 4:12: expected ';', found '-', try --help
exit status 1
I really have no clue what is going on there ;). Any ideas? Thanks.
This is due to the fact that the generator does not yet support Extended signal multiplexing.
PR #42 adds support for this feature.
Running the command you provided in after checking out PR #42 causes the error you get when replacing m1M
with m1
. This is due to the name of the dbc file, which contains a dot. This causes it to parse an invalid go package name CSS-Electronics-OBD2-Extended-v1.4can
. By renaming the file to e.g. obd2Extended.dbc
, you get a package name obd2Extendedcan
which is valid, and the generation succeeds. In short:
- Check out #42
- Rename dbc file to
obd2Extended.dbc
- Run cantool again
Added this fix for the package naming #97