Standard frames are cut at 10th bit, instead of 11th
Describe the bug
If standard frames are tried to send, the can id is cut at the 10th bit instead of 11th bit
To Reproduce
send a message with can id 0x7FF (any data), and set the property is_extended_id to False -> at the can output the id is set to 0x3FF instead of 0x7FF.
Expected behavior
id must be 0x7FF
Additional context
OS and version: Raspbian GNU/Linux 11 (bullseye) Python version: 3.9.2 python-can version: 4.2.2 python-can interface/s (if applicable):
Traceback and logs
def func():
return "hello, world!"
Can you provide more information? Which interface do you use for sending? And how do you receive the message?
Hi,
I have tested it with an raspberry pi, connected to it 3 MCP2515 CAN shields via SPI. The data (can id's,...) that I send was checked via can-utils -> candump. My second device that received the data from the PI, is a Victron CerboGx device. At his system i checked the CAN data as well via the can-utils package and candump. When i set the extended id flag to true -> extended ID it was working fine, only if I set this for the message to false it is not working for large id's where the MSB bit (of the 11) is set....
BR
Jochen
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virenfrei.www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
zariiii9003 @.***> schrieb am Mo., 13. Nov. 2023, 20:53:
Can you provide more information? Which interface do you use for sending? And how do you receive the message?
— Reply to this email directly, view it on GitHub https://github.com/hardbyte/python-can/issues/1689#issuecomment-1808943609, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL3NPGHDHFB7XVOLOB3J673YEJ3EBAVCNFSM6AAAAAA7JAO5O6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBYHE2DGNRQHE . You are receiving this because you authored the thread.Message ID: @.***>
@lumagi Could you take a look at this? I'm a Windows user 😬
This might be a tricky one to debug :D
I have several questions:
- You're using the python-can SocketCAN interface, right?
- Do you have a sample code?
- How do you set up your device? (
ip link ....)? - Which kernel version are you using?
- Did you also encounter this behavior in the past? Or did it happen after an update?
- Does it also happen if you use
cansendto send the frame? - Can you send me the output of
lsmod? - can you see the incorrect CAN ID only on the CerboGx or also on the Pi when you use candump?
If you're really using SocketCAN, then my guess is that this is a problem with the MCP2515 kernel driver. If it was with python-can or the generic SocketCAN code, we would have probably heard about it more.