Timestamp of received CAN msg

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
gmlim
Posts: 9
Joined: Wed 9. Dec 2015, 00:56

Timestamp of received CAN msg

Post by gmlim » Tue 17. May 2016, 00:44

Hi

I would like to understand for the below TPCANRdMsg structure what is the meaning for remainder in micro-seconds?

Code: Select all

typedef struct {
	TPCANMsg Msg;          // the above message
	DWORD    dwTime;       // a timestamp in msec, read only
	WORD     wUsec;        // remainder in micro-seconds
} TPCANRdMsg;            // for PCAN_READ_MSG
I am currently using 2 Peak-CAN USB Pro FD devices on Linux Redhat with PeakCAN driver version 7.15.2 and chardev mode, for reading of CAN msg I am using blocking wait with timeout of 1 second.

May I check will the timestamp for the 2 seperate devices (e.g. device 1 and 2) be synchronised?

As I realised that when I unplug and reconnect one of the device (e.g. device 1), then I start to read in CAN msg from both devices, the timestamp of device 1 will show 0 for a period of time before it jumps to some values that is closer to the timestamp of device 2, but there is still quite a big difference in their received timestamps of around 500 ms.

Thank you for your time.

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Timestamp of received CAN msg

Post by PEAK-Support » Tue 17. May 2016, 11:17

Could you please download the latest BETA Driver Version 8.0.25 with CAN FD Support from our LINUX page and test this version. Therse are some timing features fixed.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

gmlim
Posts: 9
Joined: Wed 9. Dec 2015, 00:56

Re: Timestamp of received CAN msg

Post by gmlim » Wed 18. May 2016, 03:28

Hi Wilhelm

I have tried to install the latest BETA Driver Version 8.0.25 but it was not successful
Below are the output for your reference

Code: Select all

[gm@gm peak-linux-driver-8.0.25-beta]$ make clean
make[1]: Entering directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver'
rm -f src/*o src/*~ src/.*cmd *o *ko *~ .*cmd  pcan.mod.c
make[1]: Leaving directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver'
make[1]: Entering directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/lib'
rm -f src/*~ src/*.o *~ *.so.* *.so
make[1]: Leaving directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/lib'
make[1]: Entering directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/test'
rm -f src/*~ src/*.o *~ receivetest transmitest bitratetest filtertest pcan-settings pcanfdtst
make[1]: Leaving directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/test'


[gm@gm peak-linux-driver-8.0.25-beta]$ make
make[1]: Entering directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver'
make[1]: Nothing to be done for `depend'.
make[1]: Leaving directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver'
make[1]: Entering directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver'
***
*** Host machine kernel version=2.6.32-431.el6.i686
*** Driver kernel version=2.6.32
*** Path to kernel sources=/lib/modules/2.6.32-431.el6.i686/build
*** use KBUILD=yes
*** cc version=4.4.7
***
make -C /lib/modules/2.6.32-431.el6.i686/build SUBDIRS=/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver        EXTRA_CFLAGS="-I/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver        -DNO_DEBUG -DMODVERSIONS -DPARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DDONGLE_SUPPORT -DPCCARD_SUPPORT -DNO_NETDEV_SUPPORT	 -DNO_RT " V=0 modules
make[2]: Entering directory `/usr/src/kernels/2.6.32-431.el6.i686'
  CC [M]  /usr/local/swdev/peak-linux-driver-8.0.25-beta/driver/src/pcan_main.o
In file included from /usr/local/swdev/peak-linux-driver-8.0.25-beta/driver/src/pcan_main.c:44:
/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver/src/pcan_common.h:87:1: warning: "pr_warn" redefined
In file included from /usr/local/swdev/peak-linux-driver-8.0.25-beta/driver/src/pcan_common.h:51,
                 from /usr/local/swdev/peak-linux-driver-8.0.25-beta/driver/src/pcan_main.c:44:
include/linux/kernel.h:586:1: warning: this is the location of the previous definition
In file included from /usr/local/swdev/peak-linux-driver-8.0.25-beta/driver/src/pcan_main.c:44:
/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver/src/pcan_common.h: In function ‘pcan_getnow_ns’:
/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver/src/pcan_common.h:118: error: implicit declaration of function ‘ktime_get_ns’
make[3]: *** [/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver/src/pcan_main.o] Error 1
make[2]: *** [_module_/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver] Error 2
make[2]: Leaving directory `/usr/src/kernels/2.6.32-431.el6.i686'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver'
make[1]: Entering directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/lib'
cc src/libpcan.c -DNO_RT -I. -I../driver -fPIC -shared -O2 -Wall  -lc  -Wl,-soname,libpcan.so.0 -o libpcan.so.0.6
ln -sf libpcan.so.0.6 libpcan.so
cc src/libpcanfd.c -DNO_RT -I. -I../driver -fPIC -shared -O2 -Wall  -DPCANFD_OLD_STYLE_API -lc  -Wl,-soname,libpcanfd.so.0 -o libpcanfd.so.0.1
ln -sf libpcanfd.so.0.1 libpcanfd.so
make[1]: Leaving directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/lib'
make[1]: Entering directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/test'
cc -DNO_RT -g -I. -I../lib -I../driver  src/receivetest.c src/common.c  -lpcanfd -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o receivetest
cc -DNO_RT -g -I. -I../lib -I../driver  src/transmitest.cpp src/common.c src/parser.cpp  -lpcanfd -L../lib -L/lib -L/usr/lib -L/usr/local/lib -lstdc++ -o transmitest
cc -DNO_RT -g -I. -I../lib -I../driver  src/bitratetest.c src/common.c  -lpcanfd -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o bitratetest
cc -DNO_RT -g -I. -I../lib -I../driver  src/filtertest.cpp src/common.c  -lpcanfd -L../lib -L/lib -L/usr/lib -L/usr/local/lib -lstdc++ -o filtertest
cc -DNO_RT -g -I. -I../lib -I../driver  src/pcan-settings.c  -lpcanfd -L../lib -L/lib -L/usr/lib -L/usr/local/lib -lpopt -g -o pcan-settings
cc -DNO_RT -g -I. -I../lib -I../driver  src/pcanfdtst.c  -lpcanfd -L../lib -L/lib -L/usr/lib -L/usr/local/lib -o pcanfdtst
make[1]: Leaving directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/test'
[gm@gm peak-linux-driver-8.0.25-beta]$ 

Code: Select all

[gm@gm peak-linux-driver-8.0.25-beta]$ sudo make install
make[1]: Entering directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver'
Info: /lib/modules/2.6.32-431.el6.i686/misc exists.
cp: cannot stat `pcan.ko': No such file or directory
make[1]: *** [install_files] Error 1
make[1]: Leaving directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/driver'
make[1]: Entering directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/lib'
mkdir -p /usr/lib
cp libpcan.so.0.6 /usr/lib
ln -sf libpcan.so.0.6 /usr/lib/libpcan.so.0
ln -sf libpcan.so.0 /usr/lib/libpcan.so
mkdir -p /usr/include
cp libpcan.h /usr/include
chmod 644 /usr/include/libpcan.h
cp libpcanfd.so.0.1 /usr/lib
ln -sf libpcanfd.so.0.1 /usr/lib/libpcanfd.so.0
ln -sf libpcanfd.so.0 /usr/lib/libpcanfd.so
cp libpcanfd.h /usr/include
chmod 644 /usr/include/libpcanfd.h
/sbin/ldconfig
make[1]: Leaving directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/lib'
make[1]: Entering directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/test'
cp receivetest transmitest bitratetest filtertest pcan-settings pcanfdtst /usr/local/bin
make[1]: Leaving directory `/usr/local/swdev/peak-linux-driver-8.0.25-beta/test'
[gm@gm peak-linux-driver-8.0.25-beta]$ 
Thank you.

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Timestamp of received CAN msg

Post by PEAK-Support » Wed 18. May 2016, 09:02

Please use a Kernel Version 3.x - we do no longer support Kernel 2.x with our drivers. We only test all our new drivers on actually Kernel Version.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Saike
Posts: 7
Joined: Wed 18. May 2016, 06:31

Re: Timestamp of received CAN msg

Post by Saike » Thu 2. Jun 2016, 03:48

Hi,

I'm facing the same problem.

I have downloaded BETA Driver Version 8.0.25.
When i sudo make install, it shows "cannot stat `pcan.ko': No such file or directory" error
I'm using ubuntu 14.04 kernel version 3.13.0

Please help

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Timestamp of received CAN msg

Post by PEAK-Support » Thu 2. Jun 2016, 08:39

Which "same problem" ? the original thread was a time stamp problem, the solution was to use a new Linux Version.So what exact is your Problem? If it is NOT the problem from the first thread entry, please opne a new one and explain in detail what does not work. First take a look at this thread and follow the text step by step.
You also need to decide if you want to use CahrDev or SocketCAN mode.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply