Linux-Can Archive mirror
 help / color / mirror / Atom feed
From: "Dr. Michael 'Mickey' Lauer" <mickey@vanille.de>
To: linux-can@vger.kernel.org
Subject: Candump timing issues
Date: Wed, 24 Jan 2024 15:58:57 +0100	[thread overview]
Message-ID: <AE1EC1F4-8356-49AA-8CB2-748683014B23@vanille.de> (raw)

I’m writing a MCP2518fd driver (for an ESP32) and am using my Logic Analyzer
to measure timing. I have a simple „echo“ program where the MCP repeats every
CAN frame it receives. The sender is a pretty fast Linux machine using

cangen can0 -I 777 -L 8 -D r -v -v -g 1000

I’m also monitoring this (on the same machine) via

candump -D -catd can0

Here’s an excerpt from a few seconds:

 (000.000000)  can0  777   [8]  94 F8 BF 7E F1 6E 68 6B   '...~.nhk'
 (000.000770)  can0  777   [8]  94 F8 BF 7E F1 6E 68 6B   '...~.nhk'
 (000.999518)  can0  777   [8]  0E 99 51 48 E6 FF CE 64   '..QH...d'
 (000.000733)  can0  777   [8]  0E 99 51 48 E6 FF CE 64   '..QH...d'
 (000.999406)  can0  777   [8]  AC 1C A4 01 B7 10 FC 7C   '.......|'
 (000.000854)  can0  777   [8]  AC 1C A4 01 B7 10 FC 7C   '.......|'
 (000.999348)  can0  777   [8]  53 DA B4 5B 58 EA B4 5C   'S..[X..\'
 (000.000769)  can0  777   [8]  53 DA B4 5B 58 EA B4 5C   'S..[X..\'
 (000.999483)  can0  777   [8]  BF 2E 36 77 49 52 A0 1D   '..6wIR..'
 (000.000796)  can0  777   [8]  BF 2E 36 77 49 52 A0 1D   '..6wIR..'
 (000.999389)  can0  777   [8]  16 EF B7 22 85 F0 83 12   '..."....'
 (000.000735)  can0  777   [8]  16 EF B7 22 85 F0 83 12   '..."....'
 (000.999357)  can0  777   [8]  BA C4 BF 45 E3 7C CD 73   '...E.|.s'
 (000.000845)  can0  777   [8]  BA C4 BF 45 E3 7C CD 73   '...E.|.s'
 (000.999404)  can0  777   [8]  95 1B 65 1C 81 15 DB 64   '..e....d'
 (000.000731)  can0  777   [8]  95 1B 65 1C 81 15 DB 64   '..e....d‘

Now I really wonder about these values, in particular the
time between the „question“ and the „answer“. This is a CAN 2.0B
bus @ 500000bps with only two nodes.

Looking at my Logic Analyzer, it takes me about
160µs to send the received frame back into the MCP,
where then the arbitration starts on the CAN bus.

It takes an additional 200µs for the frame to be sent on the bus,
so I’d expect to see a maximum of 360µs, if this is using hardware
timestamps.

I could only see 750µs, if I were to measure from the beginning of
the „question“ and the end of the „answer“ frame, but that’s make
sense.

Is my understanding of these timestamps wrong?

Cheers,

:M:


             reply	other threads:[~2024-01-24 15:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 14:58 Dr. Michael 'Mickey' Lauer [this message]
2024-01-25 10:09 ` Candump timing issues Marc Kleine-Budde

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=AE1EC1F4-8356-49AA-8CB2-748683014B23@vanille.de \
    --to=mickey@vanille.de \
    --cc=linux-can@vger.kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).