I2C SPI USB CAN eSPI Cable Testing View All Quick Start Guides User Manuals Software Downloads Knowledge Base Videos Case Studies App Notes White Papers Sales Support About Us
Products Blog Sales Support Contact Search
Using Total Phase Products with MATLAB

By using our free product software APIs, users of Total Phase products can develop their own custom applications or even utilize the tools in external applications. One that is often inquired about is MATLAB. While Total Phase does not directly support MATLAB, it is possible to configure the device using the API to work in a MATLAB environment.

About MATLAB

MATLAB® is a programming platform used by engineers to analyze and design systems and products. Embedded engineers may use this platform for test and measurement applications. Specifically, our customers have used MATLAB for analysis and control of our tools.

Steps to Use Total Phase Products with MATLAB

Total Phase products are supported on Windows, Linux, and Mac operating systems and also include software APIs. Our product APIs support multiple languages including C, C#, Python, and VB, and come with examples. Currently, the API package does not include MATLAB drivers, but users can easily create them.

Below are the steps that users can take to use Total Phase products with MATLAB:

 

Aardvark I2C/SPI Host Adapter

1. Download and run the latest version of the Total Phase USB Drivers Installer.

2. Download and unzip the latest version of the Aardvark Software API.

3. Go the c directory in the Aardvark Software API package.

4. Modify the functions' names in the aardvark.h file.

  • On the file, perform a “search and replace” to rename all functions to have a "c_" prefix. (The Aardvark API functions are not exposed from aardvark.dll with the names listed in the user manual. The aardvark.c source files acts as a wrapper for the dll functions to the API functions which all have the prefix "c_". Those functions' names are exported public. So, aardvark.dll have functions called "c_aa_open" instead of "aa_open” as seen in aardvark.h. This name modification ensures that the dll and h files match).

5. Run the Mathworks loadlibrary command.

6. Call loadlibrary('aardvark.dll',['aardvark.h'],'mfilename','aardvark_matlab'). (The Mathworks loadlibrary command takes c header file and creates m wrapper instead. This command creates a file called aardvark_matlab.m).

7. Continue with the programing based on the system requirements.

Mathworks offers an “Instrument Control Toolbox Support Package” for the Aardvark I2C/SPI Host Adapter that enables users to use the Aardvark adapter to communicate, using I2C or SPI interfaces, with chips, circuit boards, or sensors remotely from a computer running MATLAB. Find the package here and instructions to install here.

 

Cheetah SPI Host Adapter

1. Download and run the latest version of the Total Phase USB Drivers Installer.

2. Download and unzip the latest version of the Cheetah Software API.

3. Go the c directory in the Cheetah Software API package.

4. Modify the functions' names in the cheetah.h file.

  • On the file, perform a “search and replace” to rename all functions to have a "c_" prefix. (The Cheetah API functions are not exposed from cheetah.dll with the names listed in the user manual. The cheetah.c source files acts as a wrapper for the dll functions to the API functions which all have the prefix "c_". Those functions' names are exported public. So, aardvark.dll have functions called "c_ch_open" instead of "ch_open” as seen in cheetah.h. This name modification ensures that the dll and h files match).


5. Run the Mathworks loadlibrary command.

6. Call loadlibrary('cheetah.dll',[cheetah.h'],'mfilename','cheetah_matlab'). (The Mathworks loadlibrary command takes c header file and creates m wrapper instead. This command creates a file called cheetah_matlab.m).

7. Continue with the programing based on the system requirements.

 

Promira Serial Platform

1. Download and run the latest version of the Total Phase USB Drivers Installer.

2. Download and unzip the latest version of the Promira Software API.

3. Go the c directory in the Promira Software API package.

 4. Modify the functions' names in the promira.h file.

  • On the file, perform a “search and replace” to rename all functions to have a "c_" prefix. (The Promira API functions are not exposed from promira.dll with the names listed in the user manual. The promira.c source files acts as a wrapper for the dll functions to the API functions which all have the prefix "c_". Those functions' names are exported public. So, promira.dll have functions called "c_pm_open" instead of "pm_open” as seen in promira.h. This name modification ensures that the dll and h files match).

 5. Run the Mathworks loadlibrary command.

 6. Call loadlibrary('promira.dll',[promira.h'],'mfilename','promira_matlab'). (The Mathworks loadlibrary command takes c header file and creates m wrapper instead. This command creates a file called promira_matlab.m).

7. Continue with the programing based on the system requirements.

 

Beagle Protocol Analyzers

1. Download and run the latest version of the Total Phase USB Drivers Installer.

2. Download and unzip the latest version of the Beagle Software API.

3. Go the c directory in the Beagle Software API package.

4. Modify the functions' names in the beagle.h file.

  • On the file, perform a “search and replace” to rename all functions to have a "c_" prefix. (The Beagle API functions are not exposed from beagle.dll with the names listed in the user manual. The beagle.c source files acts as a wrapper for the dll functions to the API functions which all have the prefix "c_". Those functions' names are exported public. So, beagle.dll have functions called "c_bg_open" instead of "bg_open” as seen in beagle.h. This name modification ensures that the dll and h files match).

5. Run the Mathworks loadlibrary command.

6. Call loadlibrary('beagle.dll',[beagle.h'],'mfilename','beagle_matlab'). (The Mathworks loadlibrary command takes c header file and creates m wrapper instead. This command creates a file called beagle_matlab.m).

7. Continue with the programing based on the system requirements.

Additional Notes

We recommend customers use the correct API architecture (32 or 64 bit). In the API software package, we include several code examples that include integrating with MATLAB as well as many chips and devices. These examples can be customized as needed. Multiple customers have used this information to successfully implement MATLAB with their Total Phase device.

For further information, we recommend taking a look at our API documentation in our product user manuals:

Aardvark I2C/SPI Host Adapter User Manual

Cheetah SPI Host Adapter User Manual

Promira Serial Platform I2C/SPI Active User Manual

Beagle Protocol Analyzer User Manual

Please note that further high-level guidelines for implementing MATLAB with our devices is out of our scope. Such questions can be directed at Mathwork support.

Related Products