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
Using the Komodo CAN Duo Interface, How Do I Access CAN Data that Has Been Collected with the Komodo API?
Rena Ayeras

Man with a laptop thinking about how to access data that was collected

Image by Vanessa Garcia

Question from the Customer:

I am using the Komodo CAN Duo Interface with the Komodo Software API. I am applying the function can_async_submit to submit a command asynchronously. I am using can_async_collect to see the data, but this function does not give me access to the collected DATA. My question - how can I access CAN data that was collected?

Response from Technical Support:

Thank you for your question! There are additional commands to apply to access the data. We will describe those commands and provide guidelines about using API commands to improve performance and resolve issues that may occur.

How to Access CAN Data

Data can be accessed from the transmitter side as well as the receiver side of the CAN bus.

Accessing CAN Data from Transmitter Side

There are two commands to implement in the order shown:

  1. km_can_async_submit this function queues as many CAN transmit packets as possible:

    1. Subsequent packets are delivered while the first packet in in process.
    2. A collect response is delivered to the previously submitted packet.
    3. Other functions can be performed while the Komodo CAN Interface is sending the previous packet.
  2. km_can_async_collect checks the response for each completed CAN transmit packet to determine whether the transmission was successful or not.

    1. If the response indicates OK, “Collected packet” is printed; otherwise, the response is “Error”.

Accessing CAN Data from Receiver Side

There is one command to implement for the receiver side:

  • km_can_read waits for and reads the CAN receive packets.

For more information, please refer to the API documentation section in the Komodo CAN Interface user manual and the API example scripts async, monitor, and loopback provided with the Komodo API package.

Improving CAN Bus Performance with Komodo API

This section provides summaries of resolutions for known problems. Links to the original documents are included.

Send Scan and Store Data

There are two ways to manage data captured by the Komodo CAN Interface: use the batch command with the Komodo GUI Software or create a script with Komodo Software API. For more information, refer to How Do I Send CAN Messages, Access and Store Data with a CAN Interface?

Resolve Buffer Overflow for Asynchronous CAN Messages

Overflow can be resolved by adding latency to the read function: allow more time for the read function to complete its process. Using km_latency splits the total amount of buffering to a group of smaller sub-buffers. This method does affect the speed of the overall process. For more information, refer to How Can I Resolve Buffer Overflow for Asynchronous CAN Messages.

Threading Commands

The two virtual ports of the Komodo CAN interface can be synchronized by wrapping each Komodo API call with a thread-safe locking mechanism. For more information, refer to What are the Available Software API Examples for the Komodo CAN Duo Interface and How Can I Execute Commands on Different Threads?

Minimize OS Latency

Latency related to the USB Request Block (URB) for each CAN packet can be set to zero or to a specific duration. Latency from the operating system of the host computer is inherent. Should OS latency become an issue, timeout values can be applied with a Komodo API script. For more information, refer to How Can I Set a Timeout to Minimize OS Latency when Interfacing on the CAN Bus?

Increase CAN Bus Speed and Bandwidth

Bus speed can be accelerated by using asynchronous messages, as well as avoiding saturation (overflow) and optimizing bus speed. Asynchronous operations allow a CAN channel to receive messages asynchronously on the other channel. Overflow can be managed by reducing traffic between calls to the Komodo Software API. Traffic can be enhanced with polling and using the write command km_can_write, which acts as a wrapper for asynchronous functions. Bus speed can be enhanced in two ways: using shorter cables and software threading.  For more information, refer to How Can I Increase CAN Bus Speed and Bandwidth Occupancy?

Additional Information

Case Study - Komodo CAN Duo Interface - AVADirect Custom Computers is a case study that features the  Komodo CAN Interface and how it is used to help create a virtual reality forklift simulator for training with advanced equipment. This simulation accelerated real-time training of advanced physical equipment.

We hope this answers your question. Additional resources that you may find helpful include the following:

If you want more information, feel free to contact us with your questions, or request a demo that applies to your application.