First off, my problem isn't purely a PCAN-View issue, so I apologize in advance if this isn't the correct sub forum. Anyway, I'm using the Peak PCAN-USB adapter (firmware version: 2.8, driver versiom: 3.8.2) and PCAN-View version 4.0.28.419 on Windows 7.
I have a C++ application that uses Keneth Wagner's PCAN-Basic API to read messages from the bus. Basically, the C++ app runs in an infinite loop and uses the following code to keep pulling incoming messages from the bus:
Code: Select all
TPCANMsg msg = {};
TPCANTimestamp ts = {};
// m_CAN_handle is a pointer to an instance of Keneth Wagner's PCANBasicClass.
const TPCANStatus ret = m_CAN_handle->Read( getHandleValue( QString::fromStdString( m_openHandle ) ), &msg, &ts );
if ( ret == PCAN_ERROR_OK )
{
// copy driver specific type to msg data
dataIn.id = msg.ID;
dataIn.flags = msg.MSGTYPE;
dataIn.len = msg.LEN;
for ( std::size_t i = 0; i < CANDRIVER_MAX_DATA; ++i )
{
dataIn.data[ i ] = msg.DATA[ i ];
}
timestamp.ms = ts.millis;
timestamp.us = ts.micros;
return cOK;
}
else
{
// print error message ...
}
In other words, there are messages that my C++ code should have received but for some reason did not. The PCAN-View trace proves that these messages went through the PCAN-USB adapter, but for whatever reason I'm not able to read those messages. I'm not getting an error code either. It's as though these messages are somehow lost. And it's not all messages either. Most of the messages shown in the PCAN-View trace show up in my own log as well, but some don't. Now you may think that I'm seeing those messages in the PCAN-View trace but not in my own receive-log because maybe my C++ program is _sending_ instead of receiving them, but this cannot be the case because my C++ program NEVER sends any messages of that particular type.
Now comes the weirdest part of all. Occassionally, like maybe in 1 out of 10 runs or so, some of those "missing" messages are actually picked up by my program!

I've been trying to get to the root of this issue for the last 8 hours and I'm at my wit's end here. Does anyone have any ideas what it is that I might be doing wrong here?