There are situations where it is necessary to verify, for example, the response time of a device that communicates via CAN bus on command. In this case, however, it is necessary to know not only the time of arrival of data over the CAN bus but also the time of sending the command. For simple situations, an oscilloscope can be used to measure the time between two messages. However, as soon as it is a normal operation on the CAN bus, when the bus is under load, the situation becomes more complicated. With an ordinary oscilloscope that does not support decoding CAN bus data this is almost impossible to do - it is very difficult to tell the messages apart and identify both the command and the response, not to mention the problem of setting the oscilloscope trigger to a specific message and also having to decode the data. When using an oscilloscope that supports decoding this is already better, but very impractical in terms of quickly navigating the data.
Normally the PP2CAN program displays the time of sending from the PC, its resolution is insufficient for some cases, like the case of the mentioned response. Therefore, if you need data with very precise timestamps, it is possible to use the 3.xx series firmware for the USB2CAN Triple converter, which passes back to the PC information about exactly when the data was sent to the CAN bus.
This information carries a precise timestamp with a resolution in microseconds of when the message was actually sent. This is the same timestamp source as for received CAN bus messages and so the response can be measured with an accuracy of tens of microseconds.
This function is part of the alternative firmware, as in the case of firmware with HW gateway function. These functions are rarely used and so there is no reason to burden the MCU and USB with these functions if the user does not use them. Therefore, the base firmware does not include these features and its code is optimized for response speed and data throughput.
This PP2CAN feature and the firmware for the USB2CAN triple are included in PP2CAN 3.041 and X2CAN API 3.010.
Sent timestamped messages can be intercepted in the X2CAN API, for example by registering a callback function:
typedef void (*tX2CAN_SendCallback)(CAN_MESSAGE *message);
X2CAN_DLLMAPPING void X2CAN_RegisterSendCallback(tX2CAN_SendCallback callback);
Or collect using the callback:
X2CAN_DLLMAPPING bool USB2CAN_TRIPLE_GetCANTXMessage(CAN_MESSAGE *message);
X2CAN_DLLMAPPING bool USB2CAN_TRIPLE_WaitForTxMessage(const unsigned int timeout);
The condition that if a callback is registered , the USB2CAN_TRIPLE_GetCANTXMessage function does not work, the data is not stored in the queue.
In case the 3.xx firmware is used, it is necessary in the application that uses the X2CAN API to select the data from the queue or at least register an empty callback to avoid data accumulation in the queue.