LabView VI not emptying the receive buffer fast enough

This forum covers third party software that is for example developed with our APIs
Post Reply
Posts: 1
Joined: Mon 17. Jan 2022, 11:05

LabView VI not emptying the receive buffer fast enough

Post by Ashworth » Mon 17. Jan 2022, 11:13

I am using Labview with a Peak USB CAN-FD unit. The VI's supplied seem to be not capable of emptying the receive buffer fast enough. I have a 32-byte message being transmitted at 4000Hz @4MBit/s. Within a few seconds I get an error saying the receive buffer is not being emptied fast enough. There appear to not be a "Read Buffered" message type VI, so it has to essentially read each message an build its own buffer until the Receive flag is false. This process takes too long with the message detailed above.

Sales & Support
Sales & Support
Posts: 786
Joined: Fri 20. Sep 2019, 13:31

Re: LabView VI not emptying the receive buffer fast enough

Post by M.Heidemann » Mon 17. Jan 2022, 13:20


Which VI are you using specifically?

Please understand that we do not provide support for LabView.

The solution here would be the read within a loop until "PCAN_ERROR_QRCVEMPTY" will be returned
to ensure that the buffer is sufficiently emptied.

This is also described in the PCAN-Basic API documentation:

Code: Select all

TPCANTimestampFD timestamp;
TPCANStatus result;
char strMsg[256];

    // Check the receive queue for new messages
    result = CAN_ReadFD(PCAN_USBBUS1,&msg,&timestamp);
    if(result != PCAN_ERROR_QRCVEMPTY)
        // Process the received message
        MessageBox("A message was received");
        // An error occurred, get a text describing the error and show it
        // and handle the error
        CAN_GetErrorText(result, 0, strMsg);
        // Here can be decided if the loop has to be  terminated (eg. the bus
        // status is  bus-off)
// Try to read a message from the receive queue of the PCAN-USB, Channel 1,
// until the queue is empty
Please report back to us.

Best Regards


Post Reply