transmitest und receivetest not working

This forum covers PCAN-Linux and Linux development issues concerning our products
KatharinaB
Posts: 8
Joined: Sat 27. Jan 2018, 13:44

transmitest und receivetest not working

Post by KatharinaB » Sat 27. Jan 2018, 14:40

I am using the PCAN-PCI Single Channel (IPEH-002064) with the library v8.5.1

./lspcan -T -t -i shows:

Code: Select all

dev name	port	irq	clock	btrs	bus
[PCAN-PCI Express 0]
 |_ pcanpci0	CAN1	16	8MHz	1M	CLOSED
dmesg | grep pcan shows

Code: Select all

[ 1718.079499] pcan: Release_20171027_n (le)
[ 1718.079500] pcan: driver config [mod] [isa] [pci] [pec] [dng] [par] [pcc] 
[ 1718.084587] pcan: pci device minor 0 found
[ 1718.084685] pcan: major 237.
[ 3816.932785] pcan: __pcan_ioctl(cmd=21505): unsupported cmd (dir=0 type=84 nr=1 size=0)
[ 4704.014557] pcan: bitrate error 0.0%
[ 4704.014584] pcan: bitrate error 0.0%
[ 4704.014599] pcan: bitrate error 0.0%
[ 4704.014623] pcan: bitrate error 0.0%
[ 4704.014640] pcan: bitrate error 0.0%
[ 4704.014665] pcan: bitrate error 0.0%
[ 4704.014679] pcan: bitrate error 0.0%
[ 4704.014701] pcan: bitrate error 0.0%
[ 4704.014714] pcan: bitrate error 0.0%
[ 4704.014739] pcan: bitrate error 0.0%
[ 4704.014753] pcan: bitrate error 0.0%
[ 4704.014774] pcan: bitrate error 0.0%
[ 4704.014787] pcan: bitrate error 0.0%
[ 4704.014810] pcan: bitrate error 0.0%
[ 4704.014824] pcan: bitrate error 0.0%
[ 4704.014848] pcan: bitrate error 0.0%
[ 4704.014860] pcan: bitrate error 0.0%
[ 4704.014883] pcan: bitrate error 0.1%
[ 4704.014894] pcan: bitrate error 0.1%
[ 4704.014919] pcan: bitrate error 0.2%
ls -l /dev/pcan* shows

Code: Select all

crw-rw-rw- 1 root root 237,  0 Jan 27 11:45 /dev/pcan0
crw-rw-rw- 1 root root 237, 16 Jan 27 11:45 /dev/pcan16
crw-rw-rw- 1 root root 237, 24 Jan 27 11:45 /dev/pcan24
crw-rw-rw- 1 root root 237, 32 Jan 27 11:45 /dev/pcan32
crw-rw-rw- 1 root root 237, 40 Jan 27 11:45 /dev/pcan40
crw-rw-rw- 1 root root 237,  8 Jan 27 11:45 /dev/pcan8
crw-rw-rw- 1 root root 237,  0 Jan 27 11:40 /dev/pcanpci0

/dev/pcan-pci:
total 0
drwxr-xr-x 2 root root 60 Jan 27 11:40 0
cat /proc/pcan shows

Code: Select all

*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20171027_n (8.5.1) Jan 27 2018 11:37:35 --------------
*---------------- [mod] [isa] [pci] [pec] [dng] [par] [pcc] -----------------
*--------------------- 1 interfaces @ major 237 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
 0    pci   -NA- df200000 016 0x0014 00000001 00000000 00000000 00000000 0x0000
and my kernel is 4.13.0-32-generic and it is also up-to-date

I connected a device (with 120Ohm) to the can interface thats sends messages with a bitrate of 1Mbit/s
Unfortunately the receive and send tests do not seem to work:

./receivetest -f=/dev/pcan0 -b=0x0014 -e shows:

Code: Select all

receivetest Version "Release_20150611_n"  (http://www.peak-system.com)
------- Copyright (C) 2004-2009 PEAK System-Technik GmbH ------
receivetest comes with ABSOLUTELY NO WARRANTY.     This is free
software  and you are welcome  to redistribute it under certain
conditions.   For   details   see    attached   COPYING   file.

receivetest: device node="/dev/pcanpci0"
             Extended frames are accepted, init with BTR0BTR1=0x0014
receivetest: driver version = Release_20171027_n
936727944.635 receivetest: m s 0x00000001 4 00 00 00 00 
receivetest: pending CAN status 0x0020 read.
and once I terminate is adds

Code: Select all

^Creceivetest: type            = pci
             io              = 0xdf200000
             irq             = 16
             count of reads  = 1
             count of writes = 0
             count of errors = 0
             count of irqs   = 0
             last CAN status = 0x0020
             last error      = 0
             open paths      = 1
             driver version  = Release_20171027_n
receivetest: finished (0): 1 message(s) received
Same with

./transmitest hello.txt -f=/dev/pcanpci0 -b=0x0014 : first

Code: Select all

transmitest Version "Release_20150610_n"  (http://www.peak-system.com)
------- Copyright (C) 2004-2009 PEAK System-Technik GmbH ------
transmitest comes with ABSOLUTELY NO WARRANTY.     This is free
software  and you are welcome  to redistribute it under certain
conditions.   For   details   see    attached   COPYING   file.

transmitest: device node="/dev/pcanpci0"
             Only standard frames are sent, init with BTR0BTR1=0x0014
             Data will be read from "hello.txt".
transmitest: driver version = Release_20171027_n
and after terminating:

Code: Select all

^Ctransmitest: type            = pci
             io              = 0xdf200000
             irq             = 16
             count of reads  = 2
             count of writes = 501
             count of errors = 1
             count of irqs   = 0
             last CAN status = 0x0081
             last error      = 0
             open paths      = 1
             driver version  = Release_20171027_n
transmitest: finished (0).
Also it always shows 501 counts of writes

I hope you can help me.
Last edited by M.Gerber on Mon 12. Feb 2018, 09:25, edited 1 time in total.
Reason: Inserted [code] tags for improved readability

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: transmitest und receivetest not working

Post by S.Grosjean » Mon 29. Jan 2018, 11:27

Hello,

Code: Select all

[ 3816.932785] pcan: __pcan_ioctl(cmd=21505): unsupported cmd (dir=0 type=84 nr=1 size=0)
cmd=21505 is absolutely unknown. If this cmd comes from receivetest, so it looks like there's a problem between user and kernel spaces.

Could you please give us the result of:

Code: Select all

$ uname -a
and, also, the output of the command that built everything in the driver, that is:

Code: Select all

$ cd peak-linux-driver-8.5.1
$ make clean
$ make
$ sudo make install
Thanks.
— Stéphane

KatharinaB
Posts: 8
Joined: Sat 27. Jan 2018, 13:44

Re: transmitest und receivetest not working

Post by KatharinaB » Mon 29. Jan 2018, 12:00

uname -a returns:

Code: Select all

Linux as-desktop 4.13.0-32-generic #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
and the build:

make

Code: Select all

make[1]: Entering directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver'
make[1]: Nothing to be done for 'depend'.
make[1]: Leaving directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver'
make[1]: Entering directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver'
***
*** Host machine kernel version=4.13.0-32-generic
*** Driver kernel version=4.13.0-32-generic (4.13.0)
*** Path to kernel sources=/usr/src/linux-headers-4.13.0-32-generic
*** use KBUILD=yes
*** cc version=5.4.0
***
make -C /usr/src/linux-headers-4.13.0-32-generic  SUBDIRS=/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver        EXTRA_CFLAGS="-I/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver        -DNO_DEBUG -DMODVERSIONS -DPARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DDONGLE_SUPPORT -DPCCARD_SUPPORT -DNO_NETDEV_SUPPORT	 -DNO_RT  -Wno-date-time" V=0 modules
make[2]: Entering directory '/usr/src/linux-headers-4.13.0-32-generic'
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_main.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_fops.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_fifo.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_filter.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_parse.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_sja1000.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_common.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_timing.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcanfd_core.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcanfd_ucan.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_pci.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcanfd_pci.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_pciec.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_isa.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_dongle.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_pccard_core.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_pccard.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_usb_core.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_usb.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcan_usbpro.o
  CC [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/src/pcanfd_usb.o
  LD [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/pcan.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/pcan.mod.o
  LD [M]  /home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver/pcan.ko
make[2]: Leaving directory '/usr/src/linux-headers-4.13.0-32-generic'
make[1]: Leaving directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver'
make[1]: Entering directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/lib'
cc -DNO_RT -I. -I../driver -fPIC -Wall -Wcast-align -Wredundant-decls  -DPCANFD_OLD_STYLE_API -c src/libpcan.c -o obj/libpcan.o
cc -shared -Wl,-soname,libpcan.so.0 -o lib/libpcan.so.0.6 obj/libpcan.o 
cd lib/; ln -sf libpcan.so.0.6 libpcan.so
cc -DNO_RT -I. -I../driver -fPIC -Wall -Wcast-align -Wredundant-decls  -DPCANFD_OLD_STYLE_API -c src/libpcanfd.c -o obj/libpcanfd.o
cc -shared -Wl,-soname,libpcanfd.so.0 -o lib/libpcanfd.so.0.1 obj/libpcanfd.o 
cd lib/; ln -sf libpcanfd.so.0.1 libpcanfd.so
ar rcs lib/libpcanfd.a obj/libpcanfd.o

Info: only 64-bit version of libpcan can be built. 32-bit version of libpcan can't because the 32-bit version of libc seems not being installed...

make[1]: Leaving directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/lib'
make[1]: Entering directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/test'
cc -DNO_RT -g -I. -I../lib -I../driver    src/receivetest.c src/common.c -lpcanfd  -L../lib/lib   -o receivetest
cc -DNO_RT -g -I. -I../lib -I../driver    src/transmitest.cpp src/common.c src/parser.cpp -lpcanfd -lstdc++  -L../lib/lib   -o transmitest
cc -DNO_RT -g -I. -I../lib -I../driver    src/bitratetest.c src/common.c -lpcanfd  -L../lib/lib   -o bitratetest
cc -DNO_RT -g -I. -I../lib -I../driver    src/filtertest.cpp src/common.c -lpcanfd -lstdc++  -L../lib/lib   -o filtertest
cc -DNO_RT -g -I. -I../lib -I../driver    src/pcanfdtst.c -lpcanfd  -L../lib/lib   -o pcanfdtst
cc -DNO_RT -g -I. -I../lib -I../driver    src/pcan-settings.c -lpopt  -L../lib/lib   -g -o pcan-settings
make[1]: Leaving directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/test'
sudo make install

Code: Select all

make[1]: Entering directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver'
Info: /lib/modules/4.13.0-32-generic/misc exists.
Info: Left current 'pcan'-entry in /etc/modprobe.d/pcan.conf untouched.
Info: Copied 45-pcan.rules to /etc/udev/rules.d.
Info: mainline drivers removed and blacklisted in
      /etc/modprobe.d/blacklist-peak.conf
make[1]: Leaving directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/driver'
make[1]: Entering directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/lib'
mkdir -p /usr/lib
cp -d lib/* /usr/lib
if [ -d lib32 ]; then \
	mkdir -p /usr/lib32; \
	cp -d lib32/* /usr/lib32; \
fi
mkdir -p /usr/include
chmod 644 libpcan.h libpcanfd.h
cp libpcan.h libpcanfd.h /usr/include
/sbin/ldconfig
/sbin/ldconfig.real: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.7 is not a symbolic link

/sbin/ldconfig.real: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.5 is not a symbolic link

make[1]: Leaving directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/lib'
make[1]: Entering directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/test'
cp receivetest transmitest bitratetest filtertest pcanfdtst pcan-settings /usr/local/bin
make[1]: Leaving directory '/home/as/Devel/KIT18d/can_ws/src/libpcan/peak-linux-driver-8.5.1/test'
Last edited by M.Gerber on Mon 12. Feb 2018, 09:28, edited 1 time in total.
Reason: Inserted [code] tags for improved readability

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: transmitest und receivetest not working

Post by S.Grosjean » Mon 29. Jan 2018, 12:18

Ok. So everything seems ok (except you're running an old gcc).

Now, load the new driver:

Code: Select all

$ sudo rmmod pcan
$ sudo modprobe pcan
Then, give us the output of:

Code: Select all

$ dmesg | grep pcan
Next, launch the receive application

Code: Select all

$ receivetest -f=/dev/pcan0 -b=0x0014 -e
Finally, open another shell window and while receivetest is running, give us (again) the output of:

Code: Select all

$ dmesg | grep pcan
Regards,
— Stéphane

KatharinaB
Posts: 8
Joined: Sat 27. Jan 2018, 13:44

Re: transmitest und receivetest not working

Post by KatharinaB » Mon 29. Jan 2018, 12:58

The first output after loading the driver is:

Code: Select all

dmesg | grep pcan
[    2.169199] pcan: Release_20171027_n (le)
[    2.169200] pcan: driver config [mod] [isa] [pci] [pec] [dng] [par] [pcc] 
[    2.169224] pcan 0000:04:00.0: enabling device (0000 -> 0002)
[    2.176057] pcan: pci device minor 0 found
[    2.176431] pcan: major 238.
[ 9395.956260] pcan: removed.
[ 9411.349037] pcan: Release_20171027_n (le)
[ 9411.349038] pcan: driver config [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] 
[ 9411.354151] pcan: pci device minor 0 found
[ 9411.354202] usbcore: registered new interface driver pcan
[ 9411.354273] pcan: major 238.
and while running the receivetest it is still the same:

Code: Select all

[    2.169199] pcan: Release_20171027_n (le)
[    2.169200] pcan: driver config [mod] [isa] [pci] [pec] [dng] [par] [pcc] 
[    2.169224] pcan 0000:04:00.0: enabling device (0000 -> 0002)
[    2.176057] pcan: pci device minor 0 found
[    2.176431] pcan: major 238.
[ 9395.956260] pcan: removed.
[ 9411.349037] pcan: Release_20171027_n (le)
[ 9411.349038] pcan: driver config [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] 
[ 9411.354151] pcan: pci device minor 0 found
[ 9411.354202] usbcore: registered new interface driver pcan
[ 9411.354273] pcan: major 238.
thanks for your help
Last edited by M.Gerber on Mon 12. Feb 2018, 09:29, edited 1 time in total.
Reason: Inserted [code] tags for improved readability

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: transmitest und receivetest not working

Post by S.Grosjean » Mon 29. Jan 2018, 13:07

Ok. Up to now, everything is ok.

What does say the running receivetest? If your /dev/pcan0 is connected to your CAN bus, you should see something...

FYI, instead of receivetest, you could use the (new) pcanfdtst tool which gives more info from the CAN bus. Try:

Code: Select all

$ pcanfdtst rx -b 1M /dev/pcan0
Regards,
— Stéphane

KatharinaB
Posts: 8
Joined: Sat 27. Jan 2018, 13:44

Re: transmitest und receivetest not working

Post by KatharinaB » Mon 29. Jan 2018, 13:51

if I try pcanfdtst rx -b 1M /dev/pcan0
it returns

Code: Select all

1517229872~691085 /dev/pcan0  > BUS STATE=ACTIVE   [Rx:0 Tx:0]
and after I terminate it:

Code: Select all

/dev/pcan0 > [packets=0 calls=1 bytes=0 seq_err=0]
received frames: 0
the reveivetest retuns:

Code: Select all

./receivetest -f=/dev/pcan0 -b=0x0014 -e

receivetest Version "Release_20150611_n"  (http://www.peak-system.com)
------- Copyright (C) 2004-2009 PEAK System-Technik GmbH ------
receivetest comes with ABSOLUTELY NO WARRANTY.     This is free
software  and you are welcome  to redistribute it under certain
conditions.   For   details   see    attached   COPYING   file.

receivetest: device node="/dev/pcan0"
             Extended frames are accepted, init with BTR0BTR1=0x0014
receivetest: driver version = Release_20171027_n
1106474675.928 receivetest: m s 0x00000001 4 00 00 00 00 
receivetest: pending CAN status 0x0020 read.

and after terminating:

Code: Select all

^Creceivetest: type            = pci
             io              = 0xdf200000
             irq             = 16
             count of reads  = 1
             count of writes = 0
             count of errors = 0
             count of irqs   = 0
             last CAN status = 0x0020
             last error      = 0
             open paths      = 1
             driver version  = Release_20171027_n
receivetest: finished (0): 1 message(s) received
I also tried a different CAN device but it still shows the same result

Regards,
Katharina
Last edited by M.Gerber on Mon 12. Feb 2018, 09:31, edited 1 time in total.
Reason: Inserted [code] tags for improved readability

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: transmitest und receivetest not working

Post by S.Grosjean » Mon 29. Jan 2018, 14:23

Hi,

Well everything is ok for us. Status=0x0020 says nothing has been received by the driver from the CAN bus.
Can you check whether some frames are present on the CAN bus?

Regards,

Stéphane
— Stéphane

KatharinaB
Posts: 8
Joined: Sat 27. Jan 2018, 13:44

Re: transmitest und receivetest not working

Post by KatharinaB » Mon 29. Jan 2018, 15:54

Hello,

I have checked both devices with a can-to-usb adapter and a can-monitoring-program on a different computer and they were both sending messages. Are there maybe some basic settings I need to change on the computer

thanks for the help.

Regards
Katharina

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: transmitest und receivetest not working

Post by S.Grosjean » Tue 30. Jan 2018, 09:31

Hi,

When there's traffic on the CAN bus, type:

Code: Select all

$ pcanfdtst rx -b 1M /dev/pcan0
Then, from another shell window:

Code: Select all

$ cat /proc/pcan > /tmp/pcan_1
Then:

Code: Select all

$ pcanfdtst tx -b 1M -i 0x123 -n 100 -l 8 /dev/pcan0 > /tmp/pcanfdtst_tx_100
Then redo:

Code: Select all

$ cat /proc/pcan > /tmp/pcan_2
Finally, send us /tmp/pcan_1, /tmp/pcanfdtst_tx_100 and /tmp/pcan_2" (or copy-paste then) please.

Thanks and regards,

Stéphane
— Stéphane

Post Reply