Hi,
so I tried to use the "receivetest" and "transmittest" in the "test" directory, by having multiple terminals open:
in terminal 1:
Code: Select all
./receivetest -f=/dev/pcan0 -b=0x14
(With -f=pcan0 it doesn NOT work: "cannot open ...". Also, the "-n" option in the manual is deprecated.)
in terminal 2:
Code: Select all
./transmitest transmit.txt -f=/dev/pcan0 -b=0x14
I was under the impression, that one could connect the ports 0 and 1 (for example) physically via a CAN-cable and now transmit on pcan1, but the transmittest only allowed me to open the same port as I opened in receivetest.
in terminal 3:
dev name port bus %bus rx %fifo tx %fifo err
[PCAN-PCI Express 0]
|_ pcanpci0 CAN1 PASSIVE - 1 0.00 52 100.00 2
|_ pcanpci1 CAN2 CLOSED - 0 0.00 0 0.00 0
|_ pcanpci2 CAN3 CLOSED - 0 0.00 0 0.00 0
|_ pcanpci3 CAN4 CLOSED - 0 0.00 0 0.00 0
Nothing happened in terminal 1 and 2, so I canceled both tests. I get:
in terminal 1:
receivetest: device node="/dev/pcan0"
Only standard frames are accepted, init with BTR0BTR1=0x0014
receivetest: driver version = Release_20160608_n
receivetest: reading data from CAN ... (press Ctrl-C to exit)
^Ctransmitest: finishing
receivetest: type = pci
io = 0xf7c00000
irq = 18
count of reads = 1
count of writes = 52
count of errors = 2
count of irqs = 2
last CAN status = 0x00a0
last error = 0
open paths = 1
driver version = Release_20160608_n
in terminal 2:
transmitest: device node="/dev/pcan0"
Only standard frames are sent, init with BTR0BTR1=0x0014
Data will be read from "transmit.txt".
transmitest: driver version = Release_20160608_n
transmitest: writing data to CAN ... (press Ctrl-C to exit)
^Ctransmitest: finishing
transmitest: type = pci
io = 0xf7c00000
irq = 18
count of reads = 1
count of writes = 52
count of errors = 2
count of irqs = 2
last CAN status = 0x00a0
last error = 0
open paths = 2
driver version = Release_20160608_n
Log gives me
...
[ 1773.585588] pcan: failed requesting PCI IRQ 18 (err -16)
[ 1773.585596] pcan: can't request irq from device (err -16)
Proc interface:
*------------- PEAK-System CAN interfaces (
http://www.peak-system.com) -------------
*------------- Release_20160608_n (8.1.0) Oct 4 2016 13:44:51 --------------
*---------------------- [mod] [isa] [pci] [dng] [rt] ------------------------
*--------------------- 4 interfaces @ major 000 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
0 pci -NA- f7c00000 018 0x0014 00000001 00000034 00000002 00000002 0x0000
1 pci -NA- f7c00400 018 0x0014 00000000 00000000 00000000 00000000 0x0000
2 pci -NA- f7c00800 018 0x001c 00000000 00000000 00000000 00000000 0x0000
3 pci -NA- f7c00c00 018 0x001c 00000000 00000000 00000000 00000000 0x0000
(I tried the test with pcan1 too, that's why the baudrate is the same as pcan0)
Is there a special rtai module needed in order to run the rest properly? Currently, these rtai modules are loaded:
rtai_comedi 18864 0
kcomedilib 14229 1 rtai_comedi
rtai_netrpc 30000 0
rtai_msg 35063 0
rtai_mbx 17571 1 rtai_netrpc
rtai_fifos 38218 0
rtai_rtdm 345719 1 pcan
rtai_sem 35038 4 pcan,rtai_rtdm,rtai_mbx,rtai_netrpc
rtai_sched 101948 10 pcan,rtai_rtdm,rtai_mbx,rtai_msg,rtai_sem,kcomedilib,rtai_fifos,rtai_comedi,ni_pcimio,rtai_netrpc
rtai_hal 522893 16 mite,pcan,comedi_fc,rtai_rtdm,rtai_mbx,rtai_msg,rtai_sem,kcomedilib,comedi,ni_tio,rtai_fifos,rtai_sched,rtai_comedi,ni_pcimio,ni_tiocmd,rtai_netrpc
I also tried to run the examples in the pcanlib-basic, but during the compilation there were a few bugs, I had to fix:
- in the "PCAN_Basic_Linux-4.1.0/pcanbasic/src/pcbcore.c", line 949, I had to move the "int i" decleration out of the for-loop.
- some files could not be found, because in one of the source files in "PCAN_Basic_Linux-4.1.0/pcanbasic/src/libpcanfd/src" the path for the private lib was not set correctly
- in the "PCAN_Basic_Linux-4.1.0/pcanbasic/Makefile_latest.mk", there was somewhere a lib name wrong (libpcan instead of libpcanbasic), so it could not link correctly.
And I think that there are still other things not correct, because after finally compiling it (with RT=RTAI), the binaries still don't work:
Code: Select all
/home/rtai/PCAN_Basic_Linux-4.1.0/pcanbasic/examples/c++/pcanread
1475829127.956085: ERROR: failed to read line in file 'uevent'.
1475829127.956323: ERROR: failed to read line in file 'uevent'.
1475829127.956548: ERROR: failed to read line in file 'uevent'.
1475829127.956774: ERROR: failed to read line in file 'uevent'.
Initialize CAN: 512
Error 0x4000000
Edit:
it seem that writing works just fine. With both
Code: Select all
pcanfdtst tx --fd-non-iso -n 10 -ie 0x123 -l 2 -b 250k -d 2M -p 1s -c 60M pcan0
and the aforementioned transmittest, the tx counter of the device goes up and I can see the signal via a oszilloscope.
So my guess is, that I just cannot read on the same port while transmit. Just curious why i cannot open different ports at the same time.