Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable decode the dbc file

See original GitHub issue

I got this dbc file from csselectronics. I am using a simple python code to decode a message. But I get error saying that “KeyError: 4512038398” File “C:\DBC\”, line 17, in <module> db.decode_message(4512038398,b’FFFFFF80B2FFFFFF’) File “C:\Local\Programs\Python\Python311\Lib\site-packages\cantools\database\can\”, line 485, in decode_message message = self._frame_id_to_message[frame_id_or_name] ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ KeyError: 4512038398

I know if it is an extended id, then I have to add 0x80000000 to the frame id. I tried that too. Still that frame id cannot be found in the dbc file to decode my message. Is the following code correct?

db = cantools.database.load_file('./css2.dbc')

How do I get this dbc file working from csselectronics?

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:30 (1 by maintainers)

github_iconTop GitHub Comments

smpshehancommented, Dec 2, 2022

Thanks for all your help @juleq. So I had replace the last 2 bytes with FE. So CFE6C00 => CFE6CFE That will give me the matching frame id in my dbc file, which is a J1939 CAN dbc file

juleqcommented, Dec 1, 2022

Depends on what you want to do. If you just want to decode a few frames, you can just adapt the ids in the dbc and use cantools. If you need more elaborate j1939 support, another tool might be more useful to you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

decode error · Issue #138 · cantools/cantools - GitHub
I load successfully the sym file and I encode also the message without problems. However, decoding fails. The following python lines are ...
Read more >
CAN DBC File Explained - A Simple Intro [+Editor Playground]
A CAN DBC file (CAN database) is a text file that contains information for decoding raw CAN bus data to 'physical values'. To...
Read more >
CAN BUS tools — cantools 34.3.0 documentation
CAN BUS tools in Python 3. DBC, KCD, SYM, ARXML 4 and CDD file parsing. CAN message encoding and decoding. Simple and extended...
Read more >
Using asammdf in Python to decode CAN frames
Hi @danielhrisca I'm trying to make something that can receive raw CAN frames and log it to an mf4 file. I have a...
Read more >
Load .dbc Files and Create Messages - MATLAB & Simulink
The database .dbc file contains definitions of CAN messages and signals. ... To use a CAN database file, load the database into your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found