On 24.01.2024 15:58:57, Dr. Michael 'Mickey' Lauer wrote: > 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. These are SW timestamps. If you want to display hardware timestamps, add '-H'. You also need a CAN controller/Linux driver that support HW 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? Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Attachment:
signature.asc
Description: PGP signature