Page 1 of 1
Differentiate multiple PCAN-USB Pro FD devices on a single host
Posted: Mon 7. Nov 2022, 18:16
by PhavourFlavour
Hello,
I am using the PCAN-USB Pro FD for testing purposes at work, using Ubuntu 20.04. The PCAN-USB Pro FD is running happily together with a similar product, both using the same can_socket driver.
Now i need to scale up my infrastructure and need to use multiple CAN Boxes. I'd like to use PCAN-USB Pro FD because CAN FD is mandatory.
But PCAN-USB Pro FD does not seem to share a mac-address or any other single identification like a serial number with the host, thus identifying a single CAN Channel from multiple devices is impossible.
Is there any recommended procedure for my usecase? Running multiple PCAN-USB Pro FD on a USB Controller and identifiy + control a single CAN Channel so i know what target will end up having the can data?
For that matter: does setting a serialnumber stay when dis- and reconnection the device?
Thank you for any help!
Re: Differentiate multiple PCAN-USB Pro FD devices on a single host
Posted: Tue 8. Nov 2022, 09:27
by M.Maidhof
Hi,
you can set a device number to the PCAN-USB-Pro FD, to be able to distinguish the CAN channels. When using our peak-lunx-driver-8.xx you can use this device number to assign a specific CAN channel to a netdev canX device. You can set the device number with PCAN-View for Windows, PEAK Settings for Windows or with the pcan-settings tool available in the peak-linux-driver package. See manual of the driver for more details.
https://www.peak-system.com/fileadmin/m ... an_eng.pdf
regards
Michael
Re: Differentiate multiple PCAN-USB Pro FD devices on a single host
Posted: Wed 16. Nov 2022, 16:12
by PhavourFlavour
Hello,
thanks for that clarification! It helped me alot to this point!
I build and installed the driver according to the manual, i wrote the following install script:
Code: Select all
### install peak drivers for PCAN Linux to read device id
echo "Install drivers and dependencies for PEAK-System"
# prerequirements
sudo apt install -y make gcc linux-headers-$(uname -r) g++ libstdc++-10-dev libpopt-dev
# set variables
packagename=PCAN-Linux-Driver
cd ~
# download the driver package
wget https://www.peak-system.com/quick/$packagename
# set and unpack with suffixes
mv $packagename $packagename.gz
gzip -d $packagename.gz
mv $packagename $packagename.tar
tar -xf $packagename.tar
# setup driver folder
driver_folder=$(basename peak*)
storage_location=".driver-backups"
# make a hidden folder for driver backups
if [[ ! -d "$storage_location" ]]
then
mkdir $storage_location
fi
# always keep latest version
if [[ ! -d "$storage_location/peak" ]]
then
mkdir $storage_location/peak
fi
rm -r $storage_location/peak/*
sudo mv $driver_folder $storage_location/peak
# cleanup
rm $packagename.tar
rm -r $packagename
# build and install driver with DKMS
cd $storage_location/peak/$driver_folder
make clean
make
sudo make install_with_dkms
echo EOF
I manually set a device id with pcan-settings and I was able to read it even after reboots and reconnects - So far so good!
The Driver also seems to be installed correctly with dkms, though i still have a problem:
Since i installed the driver, reboot and reconnect a PCAN-USB Pro FD Device i can find it under
/dev but it is not registered as a network device under
/sys/class/net (as it usually was with using socketcan).
Is this expected behaviour when using the PCAN Driver or did something go wrong?
I need both the reading of devid and can as network interface.
regards,
Marco
Re: Differentiate multiple PCAN-USB Pro FD devices on a single host
Posted: Wed 16. Nov 2022, 16:47
by PhavourFlavour
PhavourFlavour wrote: ↑Wed 16. Nov 2022, 16:12
Hello,
thanks for that clarification! It helped me alot to this point!
I build and installed the driver according to the manual, i wrote the following install script:
Code: Select all
### install peak drivers for PCAN Linux to read device id
echo "Install drivers and dependencies for PEAK-System"
# prerequirements
sudo apt install -y make gcc linux-headers-$(uname -r) g++ libstdc++-10-dev libpopt-dev
# set variables
packagename=PCAN-Linux-Driver
cd ~
# download the driver package
wget https://www.peak-system.com/quick/$packagename
# set and unpack with suffixes
mv $packagename $packagename.gz
gzip -d $packagename.gz
mv $packagename $packagename.tar
tar -xf $packagename.tar
# setup driver folder
driver_folder=$(basename peak*)
storage_location=".driver-backups"
# make a hidden folder for driver backups
if [[ ! -d "$storage_location" ]]
then
mkdir $storage_location
fi
# always keep latest version
if [[ ! -d "$storage_location/peak" ]]
then
mkdir $storage_location/peak
fi
rm -r $storage_location/peak/*
sudo mv $driver_folder $storage_location/peak
# cleanup
rm $packagename.tar
rm -r $packagename
# build and install driver with DKMS
cd $storage_location/peak/$driver_folder
make clean
make
sudo make install_with_dkms
echo EOF
I manually set a device id with pcan-settings and I was able to read it even after reboots and reconnects - So far so good!
The Driver also seems to be installed correctly with dkms, though i still have a problem:
Since i installed the driver, reboot and reconnect a PCAN-USB Pro FD Device i can find it under
/dev but it is not registered as a network device under
/sys/class/net (as it usually was with using socketcan).
Is this expected behaviour when using the PCAN Driver or did something go wrong?
I need both the reading of devid and can as network interface.
regards,
Marco
I just found this topic:
viewtopic.php?t=1861
The solution isn't practical for me. But the post suggest there SHOULD be devices in
/sys/class/net even when using pcan, right?.
Thanks for your help!
Re: Differentiate multiple PCAN-USB Pro FD devices on a single host
Posted: Mon 21. Nov 2022, 07:46
by PhavourFlavour
Hello again,
after a little research, i found my problem: Using Chardev instead of Netdev Driver.
With the installed Netdev Driver I can see the devices in /sys/class/net as expected.
This means i can set a Device ID with
pcan-settings, read it via
udevadm using attribute-walk and get the network interface that represents a specific hardware device.
My case is covered. Thank you!

Re: Differentiate multiple PCAN-USB Pro FD devices on a single host
Posted: Thu 24. Nov 2022, 09:23
by PEAK-Support
Topic closed