The Total Phase Control Center Serial Software allows engineers working with the Aardvark I2C/SPI Host Adapter, Cheetah SPI Host Adapter, and Promira Serial Platform to develop and test their embedded systems.
When using these host adapters with the Control Center Serial Software, users can perform a variety of tasks; particularly, the Batch Mode feature allows for XML batch scripting to automate tasks.
In this blog, we’ll discuss the Batch Mode functionality, how to use it, and some use cases that can applied using this feature.
A batch script is a file that contains a series of commands that are executed in sequence. This is helpful in automating tasks that are generally repetitive.
In the Control Center Serial Software, the Batch Mode feature allows users specify an arbitrary set of instructions for the adapter to execute serially. This scripting language is based on XML.
The Control Center Serial Software allows users to read and write to I2C or SPI target devices, but also allows users to automate such tasks using the Batch Mode feature. For instance, if users are looking to efficiently write a series of commands or perform multiple reads at once, this can be easily achieved.
Below is an example of batch instruction commands that read and write 2 bytes at 100 kHz to and from the I2C slave address 0x50:
<aardvark>
<configure i2c="1" spi="1" gpio="0" tpower="1" pullups="1"/>
<i2c_bitrate khz="100"/>
<i2c_write addr="0x50" count="2" radix="16">00 11</i2c_write>
<i2c_read addr="0x50" count="2"/>
</aardvark>
Below are the parameters for this example:
Configuration:
Bitrate:
Write:
Read:
Users may also want to perform read and write commands to the registers of the target device to transfer I2C data to multiple sub-addresses. Using the Master Register Read function in I2C/SPI Mode in Control Center Serial Software allows users to perform this, but there is no direct command for this in Batch Mode. To perform this function, users can implement a register read in Batch Mode by using a “nostop” command following this configuration:
The example below reads 4 bytes at 100 kHz from I2C slave address 0x50 at register address 08:
<aardvark>
<configure i2c="1" spi="1" gpio="0" tpower="1" pullups="1"/>
<i2c_bitrate khz="100"/>
<i2c_write addr="0x50" count="1" radix="16" nostop="1">08</i2c_write>
<i2c_read addr="0x50" count="4"/>
</aardvark>
Where nostop="1" enables this parameter in the batch instruction commands and nostop="0" disables it.
Click here for more information on how to set up and perform a "Master Register Read" in Batch Mode.
Users can also use Batch Mode to more efficiently verify that a system set up is working as expected. When using a Total Phase host adapter with the Control Center Software and a Total Phase I2C/SPI Activity Board, users can program a test SPI or I2C device by executing an XML batch script.
This will allow users to execute a more detailed testing procedure and easily confirm their batch instruction commands are operating correctly before committing to a widespread operation.
For instructions on how to verify a test set up, please click here.
Using the Batch Mode feature is a quick and simple process.
To manually enter the commands and run the file in the Batch Mode console:
To load an existing XML file and run in the Batch Mode console:
To see a video demonstration on how to use Batch Mode, please watch Programming an EEPROM with a Total Phase I2C Host Adapter.
To use Batch Mode, a set of batch instruction commands needs to be generated in XML script format. For maximum flexibility, Batch Mode supports I2C, SPI, and GPIO functions.
For users looking for extra assistance with setting up batch instruction commands, the Control Center Serial Software includes Help Instructions that provide written instructions and guidance on how to configure the commands.
For complete instructions on how to set up an XML batch script, please see the user manual section 4.5 on Batch Mode.
While Batch Mode is a useful feature for a variety of use cases, developers may want to program custom solutions based on their own project requirements. Total Phase offers a free API for each of our tools including the Aardvark I2C/SPI Host Adapter, Cheetah SPI Host Adapter, and Promira Serial Platform. These tools can be used with our Control Center Serial Software to easily send data to I2C and SPI devices, but the same concepts can be applied to API functions. For instance, by using the respective adapter API, users can perform complex actions including:
Our APIs offer cross-platform support including Windows, Linux, and Mac, and support multiple languages like C, C#, Python 2/3, .NET, VB.NET, and VB6. Examples are also included that show how the API works, which can be modified and applied to your specific applications.
Click here to find the Software API for our host adapter tools:
If you have any questions on how Batch Mode can help complete your own programming applications, please email us at sales@totalphase.com.