Not able to connect PCAN-USB FD within Docker Image

CAN FD Interface for High-Speed USB 2.0
Post Reply
OmarAA
Posts: 2
Joined: Mon 11. Oct 2021, 01:08

Not able to connect PCAN-USB FD within Docker Image

Post by OmarAA » Mon 11. Oct 2021, 01:27

Hello all,

I am using PCAN-USB FD in order to publish some sensor information within ROS2 framework utilizing the docker image ade from https://autowarefoundation.gitlab.io/au ... n-ade.html

I get the following error at initialization:

PCAN_ERROR_ILLOPERATION: An operation is not allowed due to the current configuration

When I try the same code within a normal c++ project and run it outside the ade environment it works fine and receives the sensor information.
Any hints why such behaviour happens when running inside a docker image?

The example of used code is below:

Code: Select all

#include <pcanbasic/PCANBasic.h>

bool PCAN_Interface::initialize(){
	TPCANStatus result;
	char strMsg[256];
	TPCANBitrateFD bitrate;	
	bitrate = "f_clock_mhz=24, nom_brp=3, nom_tseg1=5, nom_tseg2=2, nom_sjw=1, data_brp=2, data_tseg1=4, data_tseg2=1, data_sjw=1"; 
	result = CAN_InitializeFD(PCAN_USBBUS1, bitrate );
	if (result != PCAN_ERROR_OK){	
		CAN_GetErrorText(result, 0, strMsg);
		std::cout << strMsg << std::endl;
		return false;
	}
	else	{
	    	std::cout << "PCAN-USB was initialized" << std::endl;
		return true;
	}
}


int main(int argc, char *argv[]){
		PCAN_Interface pcan;
 		pcan.initialize(); 
}		 


	

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

Re: Not able to connect PCAN-USB FD within Docker Image

Post by M.Heidemann » Mon 11. Oct 2021, 08:32

Hello,

Please understand that we do not support docker environments,
however we can give suggestions what you might want to check:

- Please check if the PCAN-interface is used by any application outside the container
at the given time

- Please check if the interface is recognized as intended (cat /proc/pcan)

- Make sure the same hardware is used, as not all PCAN-Interfaces support FD (The same error message
would be thrown if you try to initialize FD bitrates with non FD hardware)

Please share your findings with us.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

OmarAA
Posts: 2
Joined: Mon 11. Oct 2021, 01:08

Re: Not able to connect PCAN-USB FD within Docker Image

Post by OmarAA » Tue 12. Oct 2021, 11:55

Hello,

Thank you for your help.


1- I am not sure if there is a definite way to do it. But if I try to uninitialize first I get (A PCAN Channel has not been initialized yet or the initialization process has failed).
Another method is to check the output of:

Code: Select all

grep PEAK_ /boot/config-`uname -r`
outside the docker:

Code: Select all

CONFIG_CAN_PEAK_PCIEFD=m
CONFIG_CAN_PEAK_PCI=m
CONFIG_CAN_PEAK_PCIEC=y
CONFIG_CAN_PEAK_PCMCIA=m
CONFIG_CAN_PEAK_USB=m
inside the docker:

Code: Select all

grep: /boot/config-5.4.0-88-generic: No such file or directory

2 - cat /proc/pcan: it detects the PCAN-USB as needed inside and outside the docker environment

Code: Select all

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20210928_n (8.13.0) Oct  3 2021 02:48:46 --------------
*---------------------- [mod] [isa] [pci] [pec] [usb] -----------------------
*--------------------- 1 interfaces @ major 510 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32  usbfd   -NA-        0 000 0x0014 00000001 00000000 00000001 00000000 0x0000
3- Same hardware is used (same host PC and PCAN-USB FD), it is worth mentioning that CAN_Initialize(PCAN_USBBUS1, Baudrate) also throws the same PCAN_ERROR_ILLOPERATION error inside the docker environment


I will keep you updated if I find any solution to it.


Regards,
Omar

Post Reply