Unable decode the dbc file
See original GitHub issueI 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\test.py”, line 17, in <module> db.decode_message(4512038398,b’FFFFFF80B2FFFFFF’) File “C:\Local\Programs\Python\Python311\Lib\site-packages\cantools\database\can\database.py”, 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')
db.decode_message(4512038398,b'FFFFFF80B2FFFFFF')
How do I get this dbc file working from csselectronics?
Issue Analytics
- State:
- Created 10 months ago
- Comments:30 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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.