From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Rob__V <r.valler@enextra.de>
Cc: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [Socketcan-users] Finding a transmitter's CAN ID
Date: Mon, 19 Aug 2013 17:11:50 +0200 [thread overview]
Message-ID: <521235B6.6020502@pengutronix.de> (raw)
In-Reply-To: <521232ED.4050607@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 2029 bytes --]
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 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
next prev parent reply other threads:[~2013-08-19 15:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1376923439605-7678.post@n3.nabble.com>
2013-08-19 14:59 ` [Socketcan-users] Finding a transmitter's CAN ID Marc Kleine-Budde
2013-08-19 15:11 ` Marc Kleine-Budde [this message]
2013-08-21 13:41 ` Valler, Robert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=521235B6.6020502@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=r.valler@enextra.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox