OPT3101 SDK Training
The OPT3101 SDK is valuable because it provides register access by name on the host to make calibrations and configurations making it more readable and easier to maintain. This training will explain the register banking, answer common concerns, and show how to quickly start on the SDK.
Resources
Hi, I'm Rahland Gordon. And thank you for watching the OPT3101 SDK training video. In this video, I will highlight exactly why the OPT3101 SDK is so valuable and show you how to get started using it.
Being that the OPT3101 is a highly customizable device, there are several registers and configurations possible. The SDK, along with the configuration tool, will help accelerate the hardware cleanup and application development. These can both be found I'd go into TI.com/OPT3101 and clicking on the Tools and Software tab.
The SDK is valuable because it provides register access by name on the host to make calibrations and configurations more readable and easier to maintain. The register banking for the OPT3101 is 256 by 24 bits. In other words, each word is 24 bits of 3 bytes and there are 256 such words. All the registers occupy a specific location in the register bank as shown in the Data Sheet Register Map section.
Some of these registers are even split and stored in two word locations. So you can imagine that managing this becomes difficult without the SDK especially if there are a lot of registers to write for the configuration and calibrations. The SDK is written in C++, is light, and can even be compiled on a simple embedded system like a MSP430.
One common concern that comes because the SDK is written in C++ is that the user's existing C code on an embedded system is compatible. Well, the answer is yes with some slight changes to the existing embedded code. Some simple features like class and operator overload is used in C++. The code is very easy to understand and modify. Additionally, almost every platform that supports C++ is fully backwards compatible with C constructs.
However, there are some linkage differences that can throw some errors if the existing C code is not compiled a C++. This can simply be fixed by wrapping the header in a nested C statement. This way the SDK is compatible with the existing C code on a variety of platforms.
There are two main functions that the SDK provides. The first is that it provides a register interface accessible by name. This makes the application simple and readable, which is highly valuable during the debug things. The second thing it provides is methods and functions at a different level of obstruction to perform various tasks like initialization and calibrations. There are extensive documentations for the SDK that is available at TI.com/OPT3101 to help you.
To quickly start on the SDK, here are the things the user will have to do. First, include all the headers and the C++ files, including the one generated from the configurator tool into the existing project or a new project on the embedded hose ID environment. In the case of using a TI MSP430, the host and the embedded system has a direct I2C communication protocol API so the files inside the serial lib directory are not required. The files inside the serial lib directory are only used for communication to serial port over USB like the OPT3101 EVM connected to a PC.
Next thing is to change the compiler option in the environment to accept C++ code. In most ID environments, this is done automatically if the files included have a CPP extension. Then you must identify the I2C communication protocol on the host platform. By default, the SDK has communication protocol for the OPT3101 EVM, which needs to be overridden by the user with the API for the host specific I2C protocol.
The host controller, that CPP file, has all the definitions of all the I2C read/write methods. This has to be rewritten by the user with their own definitions of I2C calls. Once the changes are made, the serial lib definitions need to be removed. The SDK has a sample main CPP, which may interfere with the real main definition if it is already included in the existing project.
In such situations, the SDK main function can be commented out. After including the OPT3101device.h in the user's main function, an instance of the OPT3101 device class is instantiated, giving all the necessary functions to control and configure the OPT3101 device. The methods documented here can be used to help calibrate the OPT3101 system.
To access all the tools and documents that we have created to help you prototype easier and faster, visit TI.com/OPT3101. If you need technical support with OPT3101, visit TI.com/support where you will find a variety of ways to connect with us. With all these resources available to you, you can design at the speed of light, while sensing at the speed of light. Thanks for watching.
This video is part of a series
-
From zero to hero: Time-of-flight (ToF)
video-playlist (7 videos)