cantools: Unable decode the dbc file

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\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?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 33 (1 by maintainers)

Most upvoted 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