1

I would like to send and reveive CAN frames via a BCM SocketCAN in Linux with C/C++. Some frames may be 11bit others are 29bit. Each frame can have an individual cycle time and the data will change each frame. I've read the documentation but I cant figure out, if this is possible. I guess the alternative would be to do this manually via a raw socket? Any suggestions?

Thanx Andy

I've read the documentation about SocketCAN.

  • Frame data is in bytes, not bits. Use SocketCAN to send individual frames. – stark Jan 15 '23 at 12:23
  • @stark I mean the CANId can be either 11 bits or 29 bits (extended). – Andy Höfler Jan 15 '23 at 16:05
  • You should first of all figure out which programming language you are actually using: it is either C or C++, it can't be both at once. Then from there maybe post your attempts. Mixing 11 and 29 bit on the same bus isn't common, but it's a valid use-case scenario still. – Lundin Jan 16 '23 at 10:53
  • @Lundin It is a very common scenario in the mobile machine industry. There are components in a mobile machine which deliver extended frames, while others dont. Its either C or C++, doesnt really matter for this topic – Andy Höfler Jan 16 '23 at 21:18
  • @AndyHöfler My experience of mobile machines is the opposite, 11 bit is by far the most common unless it's J1939. I think I have encountered a machine with mixed 11/29 just once or twice. Most OEMs don't just toss in any random equipment on their machine and often it is custom proprietary protocols. – Lundin Jan 17 '23 at 07:08
  • @Lundin Well if you are building one on your own, you sometimes don't have the choice and mixing is inevitable. There might even be a mix with CANOpen and J1939 (on different busses of course). Depending on the equipment you have available. – Andy Höfler Jan 17 '23 at 09:27
  • @AndyHöfler Different buses is another story. This is about using 11/29 on the same one. – Lundin Jan 17 '23 at 09:32
  • @Lundin it doesnt matter, I can not circumvent the fact, that I have both identifier on the same bus. – Andy Höfler Jan 17 '23 at 12:55

0 Answers0