Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Canmatrix create dbc #753

Open
maxceng opened this issue Dec 28, 2023 · 7 comments
Open

use Canmatrix create dbc #753

maxceng opened this issue Dec 28, 2023 · 7 comments

Comments

@maxceng
Copy link

maxceng commented Dec 28, 2023

hello, i set is_little_endian to false in python canmatrix.signal.
, but the byte order in the generated dbc is Motorola format, and the start bit is converted into intel format.how can I solve it,thanks

@ebroecker
Copy link
Owner

Hi @maxceng

https://github.com/ebroecker/canmatrix/wiki/signal-Byteorder:

little endian == Intel == MOST-SIGNIFICANT-BYTE-LAST
big endian == Motorola == MOST-SIGNIFICANT-BYTE-FIRST

is_litte_endian = False means "big endian" means Motorola
which seems correct to me.

Could you provide an example?

@maxceng
Copy link
Author

maxceng commented Dec 29, 2023 via email

@ebroecker
Copy link
Owner

Hi @maxceng

I still cannot reproduce the issue.

Look at following code:

import canmatrix

network = canmatrix.CanMatrix()

sig_name = "my_name"
sig_comment  = "my_comment"
sig_name2 = "my_name2"
signal = canmatrix.Signal(name=sig_name, comments=sig_comment, is_little_endian=True)
signal2 = canmatrix.Signal(name=sig_name, comments=sig_comment, is_little_endian=False)

network.add_signal(signal)
network.add_signal(signal2)


canmatrix.formats.dumpp({"": network}, "output.dbc", "dbc")

which produces:

VERSION "created by canmatrix"


NS_ :

BS_:

BU_: 


BO_ 3221225472 VECTOR__INDEPENDENT_SIG_MSG: 0 Vector__XXX
 SG_ my_name0 : 0|0@1- (1,0) [0|0] "" Vector__XXX
 SG_ my_name1 : 7|0@0- (1,0) [0|0] "" Vector__XXX

This seems ok for me: @1 vs. @0.

Could you please provide more detail, what is going wrong at your side?
Thanks

@maxceng
Copy link
Author

maxceng commented Jan 2, 2024 via email

@maxceng
Copy link
Author

maxceng commented Jan 2, 2024 via email

@ebroecker
Copy link
Owner

Hi @maxceng

you need only to give the export-encoding:

canmatrix.formats.dumpp({"":network}, "output.dbc", "dbc", dbcExportEncoding="utf8")

@maxceng
Copy link
Author

maxceng commented Jan 3, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants