How Do I Sequence the Komodo CAN Duo Interface API Commands to Properly De-initialize a Device on the CAN Bus so that I Can Easily Re-initialize it Later?

Question from the Customer:

I have a Komodo CAN Duo Interface and I could use your help. I have a function that does de-initialization. I see km_close() returns 1 instead of KM_OK. Is this expected? What does the return value of 1 tell me?

Also, I’m trying to figure out what the proper sequence for de-initializing everything -- open, acquire, enable, power, de-power, disable, release and then close -- so that the device will return to a good state. Can you provide me a Komodo Software API example to do that?

 komodo_duo-225

Response from Technical Support:

Thanks for your questions! The km_close() API  command closes a Komodo port; it returns the number of ports closed, which is usually 1. For more details about km_close(), please refer to the API Documentation.

Here’s a sequence of API commands to apply that should get the results you’re looking for:

  1. km_find_devices() list of ports through which Komodo devices can be accessed.
  2. km_open() open a Komodo port
  3. km_acquire() acquire features from the Komodo device.
  4. km_can_bitrate()  set the bitrate
  5. km_can_target_power()  set the target power option on a CAN channel
  6. km_close()  close a Komodo port

Additional resources that you may find helpful include the following:

We hope this answers your questions. If you have other questions about our CAN interfaces or other Total Phase products, feel free to email us at sales@totalphase.com, or if you already own one of our devices and have a technical question, please submit a request for technical support.