Finding a transmitter's CAN ID
Marc Kleine-Budde
maintainerHello Rob,
please come to the new mailinglist [email protected]
Marc
Quoted 33 lines · Rob__V
Hi all,
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 ?
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.
Thank you for your time.
All the best,
Rob--
View this message in context: http://socket-can.996257.n3.nabble.com/Finding-a-transmitter-s-CAN-ID-tp7678.html
Sent from the Socket-CAN Users mailing list archive at Nabble.com.
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users
Signature · 4 lines
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 |
Marc Kleine-Budde
maintainerQuoted 11 lines · Marc Kleine-Budde
Quoted 11 lines
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?
Quoted 2 lines
Quoted 2 lines
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).
Quoted 5 lines
struct
can_frame{
canid_tcan_id; /* 32 bitCAN_ID+ EFF/RTR/ERR flags */
__u8can_dlc; /* frame payload length in byte (0 ..CAN_MAX_DLEN) */
__u8data[CAN_MAX_DLEN] __attribute__((aligned(8)));
};
Hope that helps,
Marc
Signature · 4 lines
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 |
Hello again,
Thanks all for the helpful information.
I am a little clearer on how the CAN bus works now.
All the best,
Rob
Quoted 33 lines · Rob__V
Hi all,
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 ?
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.
Thank you for your time.
All the best,
Rob--
View this message in context: http://socket-can.996257.n3.nabble.com/Finding-a-transmitter-s-CAN-ID-tp7678.html
Sent from the Socket-CAN Users mailing list archive at Nabble.com.
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users