On 23/09/11 16:07, Oliver Hartkopp wrote:
On 09/23/11 15:27, Damien R. wrote:

On 23/09/11 11:11, Damien R. wrote:
Hi,

I'm using socket can with the raw socket protocol and I receive messages
with a 11bits identifier (eg: 0x1C) but the can_id in the raw frame has
a size of 32bits. So, I have the following questions:
- How can I retrieve the 11bits identifier in the can_id ?
- Can you explain the meaning of each bit in the cand_id ?
- j1939 use a 29bits identifier, how can I retrieve the 29bits
identifier in the can_id ?

Sorry, I did not see the following part of the linux/can.h

/*
  * Controller Area Network Identifier structure
  *
  * bit 0-28    : CAN identifier (11/29 bit)
  * bit 29    : error frame flag (0 = data frame, 1 = error frame)
  * bit 30    : remote transmission request flag (1 = rtr frame)
  * bit 31    : frame format flag (0 = standard 11 bit, 1 = extended 29 bit)
  */
typedef __u32 canid_t;

So can someone explain how bits are arranged with a 11 bits identifier? Is it
this 0...0 identifier or identifier 0...0 or something else?


Hello Damien,

you may look into

http://lxr.linux.no/#linux+v3.0.4/Documentation/networking/can.txt

as well as into some sample programs you can find in the trunk/test directory
of the SocketCAN SVN on BerliOS:

http://developer.berlios.de/svn/?group_id=6475

The identifier is always a 32 bit value you can access as shown in the
examples. No need to think about the endianess of this operations on
application level.

Ok, thanks Oliver.
So if I understand correctly the examples the CAN_EFF_FLAG should be set with a J1939 message and not set with a 11bits identifier message.

Regards,
Damien R.






_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to