Page 1 of 1

Multiple PCAN USB FD with PCANBasic API for Linux

Posted: Fri 16. Feb 2018, 01:12
by teenylasers
Hello,

I can receive CAN FD messages using PCAN USB FD with some C++ code using the PCANBasic API on Ubuntu. Now I'm trying to get it working with 2 PCAN USB FD dongles. I've set the device IDs to 13 and 16, respectively, using e.g.

peak-linux-driver-8.5.1/test/pcan-setting -f=/dev/pcanusbfd32 -d=15

My question is, how do I use the device IDs to individually initialize and read CAN messages? For a single device, I use the following to initialize and read

Status = CAN_InitializeFD(PCAN_USBBUS1, bitRate);
Status = CAN_ReadFD(PCAN_USBBUS1, &Message, NULL)

What's the equivalent using Device ID instead of "PCAN_USBBUS1"?

Thanks,

- j

Re: Multiple PCAN USB FD with PCANBasic API for Linux

Posted: Fri 16. Feb 2018, 09:20
by S.Grosjean
Hi,

There is no "direct" method: your application will have to open each PCAN_USBBUSi and call:

Code: Select all

CAN_GetValue(pcanHandle, PCAN_DEVICE_NUMBER, (void*)&iBuffer, sizeof(iBuffer)); 
to get each number (see: "PCANBasic_enu.chm" and "PCAN-Parameter_Documentation.pdf" page 11).

Regards,

Stéphane

Re: Multiple PCAN USB FD with PCANBasic API for Linux

Posted: Fri 16. Feb 2018, 23:01
by teenylasers
Ah I see. Works for me. Thanks!