| Prev: Application | Table of Contents | Next: Batch Instruction Commands |
Inter-IC bus, or I2C , was developed by Philips in the 1980s. I2C is a low-bandwidth, short distance protocol for on board communications. All devices are connected through two wires: serial data (SDA) and serial clock (SCL).
The Control Center I2C module consists of 2 tabs, master and slave.
There is a 2.2K resistor on each I2C line (SCL, SDA). The lines are effectively pulled up to 3.3V, so that results in approximately 1.5 mA of pull-up current. For more information about the pull-up resistors, please consult the Aardvark I2C/SPI Embedded Systems Interface datasheet.
Aardvark adapters with a hardware versions 2.00 and greater have the ability to enable the pull-up resistors through the Control Center application. To toggle the pull-up resistors, go to the menu item:
Aardvark -> I2C Pull-ups
A checkmark indicates that the pull-up resistors have been enabled on the I2C lines.
As a master device, there are two actions, write or read. For these actions, there are a number of parameters that can or must be specified: bitrate, slave Address, and other I2C features.
The bitrate is the speed of communications between the master and the slave. The maximum master I2C bitrate is 663 kbps and a minimum of 32 kbps. The Aardvark I2C module supports many intermediate bit rates between these values. More information about the bit rate can be found in the Aardvark I2C/SPI Embedded Systems Interface datasheet.
To change the bitrate, simply select a bitrate from the pull-down menu or alternatively, enter your own bitrate and press <Enter>.
If the bitrate you entered is not available, the application will display a message indicating the close matching bitrate. Click on “Yes” to accept this alternative bit rate or click on “No” to continue using the existing bitrate.
The slave address is the address of the target I2C slave device. This address can be entered in either decimal or hexadecimal notation. If using hexadecimal notation, preface the number with “0x”. For 7-bit and 10-bit addressing, the 7 and 10 least significant bits should be used to specify the address, respectively.
The Aardvark adapter supports many of the additional I2C features.
When 10-bit slave address is selected, the slave address will be treated as a 10-bit address. The appropriate actions as described in the I2C specification will be performed to address the 10-bit slave on the bus.
Note: The Aardvark slave is always a 7-bit addressed device.
When Combined Format is selected, the”combined” format will be used for Master Read commands. This feature is only enabled when 10-bit addressing is active because it is only useful when used in conjunction with 10-bit slave Addressing
This flag indicates to the Aardvark adapter that the address is a 10-bit address but that it is not necessary to send the entire address using a master write before executing the read.
For specific information about the “combined” format, consult Section 14.2 “Formats with 10-bit address” in the Philips I2C Specification. A link to the specification can be found on the Total Phase website.
When No Stop is selected, the master device will explicitly not signal the stop command after the last byte in a transaction. The bus will be held and the subsequent master read or master write events will issue the repeated start on the bus.
The “Free Bus” button will explicitly issue the stop command on the I2C bus.
If the Aardvark I2C subsystem had executed a master transaction and is holding the bus due to a previous “No Stop” transaction, the Free Bus command will issue the stop command and free the bus.
Enter the message to be sent in hexadecimal in this field. Spaces will be automatically added for better legibility but these spaces will not be sent as part of the message. The maximum message size is 64k (65535) bytes when using 7-bit addressing and 64k - 1 (65534) bytes when using 10-bit addressing.
The message can be loaded from a binary file by clicking on the “Load” . Conversely, the message can also be saved to a binary file by clicking on the “Save” button.
Once a message has been set, click on the “Master Write” button to initiate the action. The results of the action will appear in the transaction log.
This value is the maximum number of bytes the master will accept in a single transaction. The master may receive fewer bytes than are specified in this field, but not more. In the case that a slave does not have the requested number of bytes available, the remainder of the bytes will simply default to 0xff due to the pullup resistors on the bus.
An I2C slave can send messages to and receive messages from a master device after the master has initiated a transaction. An Aardvark adapter will not respond as an I2C slave device unless it has been enabled as a slave device.
When enabling an Aardvark adapter as a slave device, three parameters must be provided: the “Slave Address”, the maximum number of bytes to send (“Max Tx Bytes”) and the maximum number of bytes to receive (“Max Rx Bytes”).
This is the I2C address that the Aardvark adapter will use as an I2C slave device. The Aardvark adapter always uses a 7-bit slave address. The address is specified in the 7 least significant bits. The most significant bit is ignored.
The Max Tx Bytes and Max Rx Bytes indicates the maximum number of bytes the Aardvark device will send and receive respectively. The Aardvark adapter will not exceed the maximum number of bytes that have been specified.
An exception to this rule is “0” which indicates that the number of bytes is unlimited.
A slave response message can be set in the Aardvark adapter as a response to a write request. The message entry field operates in the same manner as the I2C master message to send field. The maximum message size is 64 bytes due to buffer limits.
The message can be loaded from a binary file by clicking on the “Load” button. Conversely, the message can also be saved to a binary file by clicking on the “Save” button.
If more bytes are requested in a transaction than have been specified in the slave response, the response string will be wrapped as many times as necessary to complete the transaction. For example if the slave response has been set to:
00 01 02 03 04
and 12 bytes have been requested, the response that is sent to the master will be:
00 01 02 03 04 00 01 02 03 04 00 01
To set the response in the slave, click on the “Set Resp” button. It is advisable to set the slave response before enabling the slave. If a response is not set before the slave is enabled, it is possible that a slave response be requested before the slave device has one to return.
All I2C messages share memory in the Aardvark adapter. Therefore it is possible that the slave response may be overwritten in the Aardvark unit.
For example, an I2C slave response is set and then Aardvark adapter is enabled as an I2C slave, but then without disabling the slave, an I2C master transaction is executed. The Aardvark adapter will implicitly deactivate the I2C slave and because of the shared memory in the Aardvark adapter the I2C master operation will almost always overwrite the I2C slave response.
The safest course of action is to set the slave response each time before enabling or re-enabling the I2C slave.
To enable the Aardvark adapter as an I2C slave, simply click on the “Enable” button.
Once the slave is enabled, the status indicator at the top of the panel will change from “Disabled” in red to “Enabled” in green.
As request arrive for the slave, the transaction log will be updated with the read and write actions that the slave performed.
To disable the Aardvark adapter as an I2C slave device, simply click on the “Disable” button. Once disabled the status indicator at the top of the panel will change from “Enabled” in Green to “Disabled” in Red.
Executing an I2C master write or I2C master read will implicitly disable the Aardvark device as an I2C slave device. After a master write or read event, it is recommended that the I2C slave response be resent to the Aardvark adapter and then it can be re-enabled as an I2C slave device.
Switching the I2C pins to GPIO will also implicitly disable the I2C slave.
SPI is a serial communication bus developed by Motorola. It is a full-duplex protocol which functions on a master-slave paradigm that is ideally suited to data streaming applications.
The SPI tab consists of two tabs: master and slave.
The SPI master and slave need to agree about the data frame for the transaction. The data frame is described by three parameters: clock polarity, clock phase and bit order.
These parameters must be the same for both the master and slave modes. More information about these parameters can be found in the Aardvark I2C/SPI Embedded Systems Interface datasheet.
The bitrate is the speed of communications between the master and the slave. The Aardvark SPI master can operate at bitrates of 125 kHz, 250 kHz, 500 kHz, 1 MHz, 2 MHz, 4 MHz, and 8 MHz. The quoted bitrates are only achievable within each individual byte and does not extend across bytes. More information about the bit rate can be found in the Aardvark I2C/SPI Embedded Systems Interface datasheet.
To change the bitrate, simply select a bitrate from the pull-down menu or alternatively, enter your own bitrate and press <Enter>.
If the bitrate you entered is not available, the application will display a message indicating the close matching bitrate. Click on “Yes” to accept this alternative bit rate or click on “No” to continue using the existing bitrate.
The SPI master has an additional parameter that can be set, the polarity of the SS line.
The SS Polarity indicates whether the Aardvark device will pull the SS pin high or low to activate the SPI slave device.
Note: When configured as an SPI slave, the Aardvark will always be setup with SS as active low.
MOSI (Master Out, Slave In) message is entered here in hexadecimal format. Spaces are automatically inserted for legibility. The maximum message size is 4 KiB due to operating system buffer limits.
The message can be loaded from a binary file by clicking on the “Load” button. Conversely, the message can also be saved to a binary file by clicking on the “Save” button.
SPI is a full duplex protocol. When the MOSI message is sent a MISO message is received. The transaction log will log MOSI and MISO as two separate transactions that occur at the same time. The length of the two messages will be the same due to the duplex nature of the protocol.
The MISO (Master In, Slave Out) message is the message that the Aardvark adapter will return as its response to a SPI transaction. Like the MOSI message, this message is entered in hexadecimal format. Spaces are automatically inserted for legibility, but are not sent in the transaction. The maximum message size is 4 KiB due to operating system buffer limits.
It is advisable to set the MISO message before enabling the slave. If a MISO message is not set before the slave is enabled, it is possible that the message may be requested before the slave device has one to return.
The message can be loaded from a binary file by clicking on the “Load” button. Conversely, the message can also be saved to a binary file by clicking on the “Save” button.
All SPI messages share memory in the Aardvark adapter. Therefore it is possible that the MISO message may be overwritten in the Aardvark unit.
For example, a MISO message is set and then Aardvark adapter is enabled as an SPI slave, but then without disabling the slave, an SPI master transaction is executed. The Aardvark adapter will implicitly deactivate the SPI slave and because of the shared memory in the Aardvark adapter the SPI master operation will almost always overwrite the MISO message.
The safest course of action is to set the MISO message each time before enabling or re-enabling the SPI slave.
An Aardvark adapter will not respond as an SPI slave device until it has been enabled. It is advisable that the MISO message be set in the slave device before it is enabled to ensure valid data to all requests.
Once the slave is enabled, the status indicator at the top of the panel will change from “Disabled” in red to “Enabled” in green. As request arrive for the slave, the transaction log will be updated with the read and write actions that the slave performed.
When the MOSI message is received a MISO message is sent to the master. The transaction log will log MOSI and MISO as two separate transactions that occur at the same time.
Executing a SPI master write will implicitly disable the Aardvark device as an SPI slave device. After a master write event, it is recommended that the MISO message be resent to the Aardvark adapter and then it can be re-enabled as an SPI slave device.
Switching the SPI pins to GPIO will also implicitly disable the SPI slave.
General Purpose IO, GPIO, allows the users to use the six pins that are normally used for I2C and SPI and use them to send and receive signals. These six pins are SCL, SDA, MOSI, SCLK, MISO, and SS. GPIO functionality can be combined with either I2C or SPI or can be used by itself.
When GPIO is combined with either I2C or SPI, only the pins of the unused module are available for GPIO. Therefore when using “I2C + GPIO” only the SPI pins are available for GPIO and when using “SPI + GPIO”, only the I2C pins are available for GPIO.
When GPIO module is selected, only the available pins are displayed in the window. Each pin is labeled and has parameters that can be set by the user.
The name of each pin is color coordinated to match the color of the lead in of the 10-pin split cable adapter. The 10-pin split cable adapter is not included with the Aardvark adapter, but is available for purchase separately on the Total Phase website.
The position of the pin in the 10-pin socket connector. Information about the pin arrangement can be found the Aardvark I2C/SPI Embedded Systems Interface datasheet and on the Total Phase website.
Each pin has a different value which can be OR-ed together to produce a single number that represents the state of all the pins.
The pins have the following values:
SCL = 0x01
SDA = 0x02
MISO = 0x04
SCK = 0x08
MOSI = 0x10
SS = 0x20
For example, if SCL, MOSI and SS where set to 1, then the value of all pins would be:
0x01 | 0x10 | 0x20 = 0x31
The direction of the pin, Input or Output.
If a pin is configured as an input pin, then the pullup selector and In Value row are enabled and the Out Set and Out Value rows are disabled.
If a pin is configured as an output pin, then the pullup selector and the In Value are disabled and the Out Set and Out Value rows are disabled.
All In and All Out
The “All In” and “All Out” buttons are convenience buttons to set all pins to input or output respectively.
Indicates whether the pullup is active or inactive on a pin. The pullup selector is only enabled when the pin is set to the in direction because the pullup are only turned on on pins that have been configured as input. If a line is configured as output, the pullup mask is cached and the pullup configuration for that line will only take effect if the line is later configured as an input.
All On and All Off
The “All On” and “All Off” buttons are convenience buttons to turn on the pullups on or off respectively on all pins.
Note: Only pins that have been configured to be input will be affected by these buttons.
It is not possible to disable the pullups for SCL and SDA input on Hardware Version 1.02.
The “Out Set” boxes are a staging area for setting the levels of the output pins. Only “0” and “1” are accepted in these text boxes.
The values in the “Out Set” boxes are only applied once the “Set” button is clicked. The “Out Value” indicates the last known values of the output pins. After clicking the Set button the “Out Set” and the “Out Value” for all pins configured as output should match. The parameters of the transaction are added to the transaction log.
If a pin is switched from output to input, the values in “Out Set” and “Out Value” are disabled but are conserved. When a pin is switched back to output, these values will be restored.
The “In Value” is the last known values of the input pins. Initially the values for the In Value will be “X” indicating that the value is not known on the pin.
The “In Value” of the input pins are updated when the “Get” button is clicked. The parameters of the transaction are added to the transaction log.
The “In Value” for an output pin will always display an “X” because the input value of this pin is not known.
In Batch mode, the user can specify an arbitrary set of instructions for the Aardvark adapter to execute in sequence. This scripting language is based on XML.
A set of batch instructions for an Aardvark adapter is scripted in an XML based language. A set of instructions must be contained within a set of <aardvark> tags. Each command is specified by an XML tag. These tags are described in section 5. Batch Instruction Commands. Commands are executed in the order that they appear in the XML block.
Help for the Batch Commands is available in the Control Center software which explains all the available commands. Just click on the “Help” button.
The Batch XML Instructions are entered in this text field. Batch instructions can be saved and loaded as XML files via the “Save” and “Load” buttons respectively. The “Clear” button will clear all contents out of the text field. The following dialog box will appear to confirm that the user wants to clear all data out of the text field.
To execute a set of batch instructions, simply click on the “Execute” button. When a script is executing, the status indicator will turn green. The results from the commands will appear in the transaction log. While a script is running, it is not possible to edit the batch instructions.
To stop the execution of a script, simply click on the “Stop” button.
Once the script has completed, the status indicator will change back to red and the batch instructions will once again be editable.
When the “Execute” button is clicked, the instruction set is parsed and validated. In the event of an error, a dialog box will open indicating the type of error and the command in which the error appears.
The format of the error message is:
n) command [attribute] - error message
where:
zero-based index of the command
command type
attribute name where the error occurred. If an error is not associated with an attribute, this field will be omitted.
error message.
Click OK to close the dialog.
I2C Monitor mode allows the user to non-intrusively record the traffic on an I2C bus. The bus monitor is limited to 125 kHz traffic. This rate can be sustained indefinitely. Monitoring traffic at faster bus rates is not supported, but is possible for short transactions.
The I2C Bus Monitor module does not make use of the transaction log. Instead it has it’s own display which logs all of the traffic on an I2C bus.
To enable the Aardvark adapter as an I2C bus monitor, simply click on the “Enable” button.
Once the bus monitor is enabled, the status indicator at the top of the panel will change from “Disabled” in red to “Enabled” in green.
To disable the Aardvark adapter as an I2C bus monitoring device, simply click on the “Disable” button. Once disabled the status indicator at the top of the panel will change from “Enabled” in Green to “Disabled” in Red.
Monitored transactions will appear in the monitor transaction display. Each entry has a timestamp. This timestamp is based on when the Control Center application monitored the data only and may differ from the actual time the data was sent on the bus.
The format of the I2C transaction is:
[S] <addr:r/w>* data [P]
Where:
start flag
target slave address (7-bit or 10-bit)
read/write bit. Either “r” or “w”
appears if a NACK occurred
stop flag
Transactions longer than 16 bytes will be broken up onto multiple lines. All lines from the same transaction will have the same timestamp.
The recorded transactions can be saved to a TXT file with the “Save” button.
The recorded transactions can be cleared with the “Clear” button. When clearing the transactions, a dialog box will appear to confirm the action.
| Prev: Application | Table of Contents | Next: Batch Instruction Commands |
|
|
|
|
© 2010 Total Phase, Inc. All rights reserved. Terms of Use | Privacy Notice | Site Map |
HOME | PRODUCTS | SOLUTIONS | SALES | SUPPORT | BLOG | COMPANY | CONTACT |