Page 1 of 1
LabView VI not emptying the receive buffer fast enough
Posted: Mon 17. Jan 2022, 11:13
by Ashworth
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.
Re: LabView VI not emptying the receive buffer fast enough
Posted: Mon 17. Jan 2022, 13:20
by M.Heidemann
Hello,
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
TPCANMsgFD msg;
TPCANTimestampFD timestamp;
TPCANStatus result;
char strMsg[256];
do
{
// Check the receive queue for new messages
//
result = CAN_ReadFD(PCAN_USBBUS1,&msg,×tamp);
if(result != PCAN_ERROR_QRCVEMPTY)
{
// Process the received message
//
MessageBox("A message was received");
ProcessMessage(msg)
}
else
{
// An error occurred, get a text describing the error and show it
// and handle the error
//
CAN_GetErrorText(result, 0, strMsg);
MessageBox(strMsg);
// Here can be decided if the loop has to be terminated (eg. the bus
// status is bus-off)
//
HandleReadError(result);
}
// Try to read a message from the receive queue of the PCAN-USB, Channel 1,
// until the queue is empty
//
}while((result & PCAN_ERROR_QRCVEMPTY) != PCAN_ERROR_QRCVEMPTY);
Please report back to us.
Best Regards
Marvin