PCAN-USB FD on Linux: Error on trying to run test program, transmitest

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
Arcon
Posts: 4
Joined: Tue 2. Mar 2021, 09:05

PCAN-USB FD on Linux: Error on trying to run test program, transmitest

Post by Arcon » Fri 12. Mar 2021, 09:27

I have installed "PCAN Linux Driver", "PCAN Basic API for Linux" and "PCAN-View for Linux" following the documentation in here.

However, on trying to run the programs in the test directory, I am getting errors.

This is my output for

Code: Select all

$ cat /proc/pcan

Code: Select all

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20210119_n (8.11.0) Mar 10 2021 11:52:35 --------------
*------------- [mod] [isa] [pci] [pec] [dng] [par] [usb] [pcc] --------------
*--------------------- 1 interfaces @ major 510 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32  usbfd   -NA-        0 000 0x001c 00000000 00000000 00000000 00000000 0x0000
And this is my output for

Code: Select all

$ uname -a

Linux fliradas 5.4.0-66-generic #74~18.04.2-Ubuntu SMP Fri Feb 5 11:17:31 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
I tried running the test program transmitest as per instruction in the documentation. Here is the output.

Code: Select all

$ transmitest transmit.txt -f=/dev/pcanusb32 –b=0x14 –e –n=100

transmitest Version "Release_20150610_n"  (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/pcanusb32"
             Only standard frames are sent, init with 500 kbit/sec.
             Data will be read from "–n=100".
transmitest: error at file read: No such file or directory
transmitest: finished (2).
I tried running with only -f option as well. Here is the output.

Code: Select all

$ transmitest transmit.txt -f=/dev/pcanusb32

Code: Select all

transmitest Version "Release_20150610_n"  (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/pcanusb32"
             Only standard frames are sent, init with 500 kbit/sec.
             Data will be read from "transmit.txt".
transmitest: can't open /dev/pcanusb32
transmitest: finished (2).
I would like to note that I was able to transmit CAN frame using PCAN-View.

I would greatly appreciate any help in figuring out the cause of the error.

Regards.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: PCAN-USB FD on Linux: Error on trying to run test program, transmitest

Post by M.Heidemann » Fri 12. Mar 2021, 09:42

Hello,

if you are using a PCAN-USB FD, the appropiate device-name would not be "pcanusb32" but "pcanusbfd32" instead.

You can check this via:

Code: Select all

ls dev | grep pcan
Example output:

Code: Select all

pcan32
pcan-usb_fd
pcanusbfd32

Please check, if that resolved your issue.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

Arcon
Posts: 4
Joined: Tue 2. Mar 2021, 09:05

Re: PCAN-USB FD on Linux: Error on trying to run test program, transmitest

Post by Arcon » Wed 17. Mar 2021, 08:43

Hi,

Thank you for the reply.

The device name should indeed have been "pcanusbfd32". However I was getting the error due to something else.
Copying and Pasting the command directly from the pdf manual into the terminal led to the error. The "-" sign for the options
was not copied properly, leading to the error.

The current output for the command

Code: Select all

$ transmitest transmit.txt -f=/dev/pcanusbfd32 -b=0x14 -e -n=100
is

Code: Select all

transmitest Version "Release_20150610_n"  (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/pcanusbfd32"
             Extended frames are sent, init with BTR0BTR1=0x0014
             Data will be read from "transmit.txt".
transmitest: driver version = Release_20210119_n
transmitest: CAN_Write(): Network is down
transmitest: type            = usbfd
             Serial Number   = 0x00000000
             Device Number   = 0
             count of reads  = 5
             count of writes = 623
             count of errors = 95
             count of irqs   = 14
             last CAN status = 0x001c
             last error      = 0
             open paths      = 6
             driver version  = Release_20210119_n
transmitest: finished (100).
As you can see, the issue now is "CAN_Write(): Network is down".

The other programs in the /test folder are running fine.
I have also tried running programs from the c++ "example" programs for linux in folder "/libpcanbasic" and they are running properly.


Do you know how to solve "Network is down" issue?

Regards.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: PCAN-USB FD on Linux: Error on trying to run test program, transmitest

Post by M.Heidemann » Wed 17. Mar 2021, 13:37

Hello,

i was unable to reproduce the issue on a correctly configured bus,
However using the wrong bitrate on the receiving end will yield the results
you have shown.

Keep in mind that your command will run transmitest at 1Mbit/s, make sure your receiving node uses the same bitrate.

Do you also have this issue, when you use a different bitrate, for example 500k? (Make sure your receiving node uses 500k as well)

You can try this via:

Code: Select all

transmitest transmit.txt -f=/dev/pcanusbfd32 -e -n=100
transmitest will default to 500k if not bitrate is given.

Please report back to us regarding this.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

Arcon
Posts: 4
Joined: Tue 2. Mar 2021, 09:05

Re: PCAN-USB FD on Linux: Error on trying to run test program, transmitest

Post by Arcon » Thu 18. Mar 2021, 01:31

Hi Marvin,

You were right. My receiving node was not configured correctly (was not 500Kbps)

The program ran without any errors after correcting for the config.

Warm Regards,
Arcon

Post Reply