Hi all,
I've got several different Peak CAN interfaces that we use on development / test rigs for some physical hardware. To control the interface I've got a kernel module that I've written that's basically a fork of the CAN-BCM module but adapted for more controlled deterministic message tx/rx rather than the basic cyclic transmission.
What I'm wanting to do is get hardware time-stamps from within the kernel module to look at received packets from the device under test and measure accuracy etc. However, I can't see a way to do this - is it possible?
Likewise, when I was last working on this (about a year or so ago!) I had to use the separate peak driver for hardware timestamping, is this still the case or can I use the mainline kernel driver now?
Thanks!
~Pev
Hardware Timestamps from kernel module
- S.Grosjean
- Software Development
- Posts: 357
- Joined: Wed 4. Jul 2012, 17:02
Re: Hardware Timestamps from kernel module
Hello,
Depending on your PEAK-Sytem CAN interface:
Regards,
Depending on your PEAK-Sytem CAN interface:
- The peak_usb driver for the PEAK-System USB devices give hardware timestamps to the network layer.
- The peak_pci driver doesn't provide hardware timestamps because the SJA1000 controller does not allow it.
- The peak_pciefd doesn't provide hardware timestamps at the moment but should in a future version of the Kernel.
Regards,
— Stéphane
Re: Hardware Timestamps from kernel module
Hi Stephane,
Thanks for the quick reply!
So, the two interfaces that I think I can use with hardware timestamps are the PCAN-USB Pro and PCAN-USB X6, is that right?
I've got a simple test app that Im playing with based off the linux-can test code :
https://github.com/linux-can/can-tests/ ... x-sendto.c
Are you saying that for these interfaces, the value gained via ioctl(s, SIOCGSTAMP, &tv) in the code above should, by default, be the hardware timestamp value from the interface when using either peak_usb or pcan drivers?
I only ask as the last time I looked at this, I think I ended up trying to follow the instructions at :
https://www.kernel.org/doc/Documentatio ... amping.txt
if memory serves me, I tried to configure manually via SIOCSHWTSTAMP and could never get to work... Is there any example code you may be able to point me at?
Also, in your opinion, is there any reason I should use either the peak_usb driver or pcan driver specifically? I don't have any particular leaning either way currently.
Thanks!
Thanks for the quick reply!
So, the two interfaces that I think I can use with hardware timestamps are the PCAN-USB Pro and PCAN-USB X6, is that right?
I've got a simple test app that Im playing with based off the linux-can test code :
https://github.com/linux-can/can-tests/ ... x-sendto.c
Are you saying that for these interfaces, the value gained via ioctl(s, SIOCGSTAMP, &tv) in the code above should, by default, be the hardware timestamp value from the interface when using either peak_usb or pcan drivers?
I only ask as the last time I looked at this, I think I ended up trying to follow the instructions at :
https://www.kernel.org/doc/Documentatio ... amping.txt
if memory serves me, I tried to configure manually via SIOCSHWTSTAMP and could never get to work... Is there any example code you may be able to point me at?
Also, in your opinion, is there any reason I should use either the peak_usb driver or pcan driver specifically? I don't have any particular leaning either way currently.
Thanks!
- S.Grosjean
- Software Development
- Posts: 357
- Joined: Wed 4. Jul 2012, 17:02
Re: Hardware Timestamps from kernel module
Hi,
Having a look to candump.c (https://github.com/linux-can/can-utils) should show you how to request the so called hardware timestamps from a linux-can managed CAN interface. In particular:
Regards,
Having a look to candump.c (https://github.com/linux-can/can-utils) should show you how to request the so called hardware timestamps from a linux-can managed CAN interface. In particular:
Code: Select all
if (timestamp || log || logfrmt) {
if (hwtimestamp) {
— Stéphane
- S.Grosjean
- Software Development
- Posts: 357
- Joined: Wed 4. Jul 2012, 17:02
Re: Hardware Timestamps from kernel module
Hi,
UPDATE: the ability to get hardware timestamps from the PCAN PCIe FD cards family using the socket-can peak_pciefd mainline driver, was pushed to the linux-can maintainers list during September 2019. It is now part of next Kernel 5.5 release candidates.
Regards,
UPDATE: the ability to get hardware timestamps from the PCAN PCIe FD cards family using the socket-can peak_pciefd mainline driver, was pushed to the linux-can maintainers list during September 2019. It is now part of next Kernel 5.5 release candidates.
Regards,
— Stéphane