On 08/19/2013 04:59 PM, Marc Kleine-Budde wrote: >> I am currently working on a project with several embedded platforms connect >> via CAN: >> 1 x Linux board connected via SocketCAN >> N x embedded boards using the Atmega16M1 (CAN) MCU. >> >> The Linux board is 'treated' as the master and needs to know the CAN ID of >> each >> atmega board that sends it a CAN message. So my question is : >> >> How is the Linux/SocketCAN board able to determine the CAN ID of other >> networked nodes when they transmit ? When we're talking about RAW CAN frames, there is no such thing as CAN id of a node, it's not an address. Neither sending nor receiving. Think of the CAN id more as a part of the data of the CAN frame. Depending on your higher level protocol there might be an addressing scheme which makes use of the CAN id. Then there is probably a CAN id (or part of) associated which each node. Are you using some kind of (standardised) protocol on top of RAW CAN? >> Of course, each CAN node can determine the target ID for each message but >> I am not sure if the source ID is known ... outside of arbitration. For arbitration purpose the CAN id of each CAN frame is used. All nodes that receive the CAN frame receive the same CAN id, in particular the CAN id the sending node put into the CAN frame. Under Linux the CAN if is stored in the "can_id" member of the "struct can_frame" (which is used for both sending and receiving CAN frames). > struct can_frame { > canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ > __u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ > __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8))); > }; Hope that helps, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |