Multiple PCAN USB FD with PCANBasic API for Linux

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
teenylasers
Posts: 4
Joined: Sat 16. Dec 2017, 03:46

Multiple PCAN USB FD with PCANBasic API for Linux

Post by teenylasers » Fri 16. Feb 2018, 01:12

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

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Multiple PCAN USB FD with PCANBasic API for Linux

Post by S.Grosjean » Fri 16. Feb 2018, 09:20

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
— Stéphane

teenylasers
Posts: 4
Joined: Sat 16. Dec 2017, 03:46

Re: Multiple PCAN USB FD with PCANBasic API for Linux

Post by teenylasers » Fri 16. Feb 2018, 23:01

Ah I see. Works for me. Thanks!

Post Reply