Dynamic DAQ lists - runtime error
Posted: Tue 23. Aug 2022, 11:19
Hello,
I'm trying to use dynamic DAQ lists with the XCP-API. Unfortunately I encounter a runtime error: Sometimes it works without any problems and I get cyclic messages containing memory readouts according to the configured lists. But sometimes - especially while creating ODT entries - the program get stuck when waiting for the XCP response.
The function receiveNextCanMessageWithID() is implemented the following way:
The program sometimes get stuck in the loop utilizing the PCANBasic.Read(...). Even if I ignore the message ID in the loop condition, it does not work. The Read-function always returns TPCANStatus.PCAN_ERROR_QRCVEMPTY in this scenario. So I attached a second CAN interface to the bus. There I can see the positive response of the XCP command. So the message I'm looking for is on the bus. But sometimes, it is not in the PCAN receive buffer. How can it be?
Thanks in advance.
I'm trying to use dynamic DAQ lists with the XCP-API. Unfortunately I encounter a runtime error: Sometimes it works without any problems and I get cyclic messages containing memory readouts according to the configured lists. But sometimes - especially while creating ODT entries - the program get stuck when waiting for the XCP response.
Code: Select all
/* ... */
XCPApi.WriteDAQListEntry(m_XcpSession, entry);
receiveNextCanMessageWithID(0x202);
/* ... */
Code: Select all
private TPCANMsg receiveNextCanMessageWithID(uint msgID)
{
TPCANMsg CANMsg;
TPCANTimestamp CANTimeStamp;
TPCANStatus stsResult;
do
{
stsResult = PCANBasic.Read(handle, out CANMsg, out CANTimeStamp);
}while(stsResult == TPCANStatus.PCAN_ERROR_QRCVEMPTY || CANMsg.ID != msgID);
return CANMsg;
}
Thanks in advance.