I2C SPI USB CAN eSPI Cable Testing View All Videos Quick Start Guides Software Downloads App Notes White Papers User Manuals Knowledge Base Sales Support About Us
Products Blog Sales Support Contact Search
Support Question of the Week: How Do I Clear the Saturated Buffer When Using the Komodo CAN Duo Interface?
Rena

I am using a Komodo CAN Duo Interface with the LabVIEW software and Komodo LabView Drivers (VI). I write a packet, and when I read the bus, the packet I am looking for has already been sent by the other node - I miss reading it. The loop works fine for two iterations before this fault occurs.

This behavior suggests a buffer is overloaded and needs to be cleared. How do I clear the buffer?

Thanks for the question! There is buffering within the Komodo DLL, on a per-device basis, which helps capture asynchronous messages. For example, in the case of the Komodo interface receiving CAN messages asynchronously:

  • If the application calls the function to change the state of a GPIO while unprocessed asynchronous messages are pending, the Komodo interface will modify the GPIO pin but will also save any pending CAN messages internally.
  • The messages are then held until the appropriate API function is called.

For more information please refer to section 3.8.1 of the Komodo Interface User Manual.

GUI Interface for Komodo LabVIEW Drivers Figure 1: Komodo LabVIEW Drivers
Here is an overview about buffering: The Komodo CAN Duo Interface can be configured as an active CAN node or as a passive monitor. A CAN channel can receive messages asynchronously with respect to the host computer software. Between the calls to the Komodo API, these messages must be buffered in memory. This is accomplished by the operating system of the computer host. The size of this buffer is limited; when this buffer is full, bytes of data are dropped.

An overflow can occur when the Komodo device receives asynchronous messages faster than the rate that they are processed - the receive link is "saturated". This condition can affect other synchronous communication with the Komodo interface.

Solutions to clear a saturated receiving buffer: There are two methods to address a saturated buffer.

  • One option is to reduce the amount of traffic that is sent by all CAN nodes between calls to the Komodo API. This requires the ability to reconfigure the offending CAN device(s).
  • The other option is to poll the CAN channel to collect pending messages more frequently. For more information, please refer to section 3.8.2 of the Komodo Interface User Manual.
Detect a filled Komodo buffer: The Komodo has a limited buffer for buffering CAN packets and CAN events. If this buffer is filled, the Komodo interface will not report new packets or events and it will stop transmitted packets on the CAN bus. This can be detected by seeing a KM_READ_END_OF_CAPTURE in the status field of the km_can_info_t struct from the km_can_read function. Also, in this scenario the CAN write functions will return with an error code of KM_CAN_SEND_FAIL.

To decrease the possibility of buffer saturation, the following steps can be taken:

  • Ensure the CAN bus is properly terminated; otherwise the Komodo is saturated with CAN errors.
  • Use only one port on the Komodo device.
  • Use only one CAN channel on the Komodo device.
  • Use a lower CAN bitrate.

For more information about CAN API functions, please refer to section 5.6.1 of the Komodo Interface User Manual.

For additional information, please refer to the following:

Komodo Interface User Manual

Total Phase Products

Product Selector Guide

We hope this answers your question. If you have other questions about our host adapters or other Total Phase products, feel free to email us at sales@totalphase.com or submit a request for technical support.