selected languagethis page is Englishno German page available

Non-Standard Buses

   

Introduction

All telos I2C products are carefully designed to comply with the relevant specifications of the I2C bus. However there are situations where the user needs to perform operations which are not standard compliant. This application note demonstrates how to use the Tracii 400 test pins to write and read to a non-I2C two wire bus.

There are numerous situations requiring a manual operation of the bus

  • The bus itself is simply not I2C but follows some other specification
  • An I2C slave device has a bug and therefore requires special treatment
  • Unidirectional optocupplers are used prohibiting Tracii to read back the value of any i2c line
  • An I2C slave needs to be tested against odd timing of the master e.g. extremely slow clock signals
  • A slave sends out extra bytes after a "not acknowledge" bit

Hardware considerations

In this application note Tracii 400 is used to communicate to an SHT11 humidity and temperature sensor made by Sensirion, but the techniques used can be applied in any of the above situations. The Tracii 400 has two dedicated output pins operating in push/pull mode and two dedicated input pins. The SHT11 sensor uses a two wire non-i2c interface but just like I2C the bus is set-up in open-drain technology. This means that the bus is at high level by default and a device will sink the current on the bus line to pull it low.

Both, the master and the slave device must be able to do this i.e. if Tracii 400 is the master it needs to be able to read back the data line modified by the slave.

Since Tracii 400 does not provide open-drain connectors as test pins a simple circuit is used to implement this functionality.

Each of the two input pins is connected to the corresponding output pin i.e. i1 to o1 and i2 to o2. This lets us read back the electrical level present on the output pins at any time.

The data line of the SHT11 sensor is then connected to O2 (and I2) over a 4k7 resistor. The same is done with the clock line and I1/O1.

Writing to a line can be done by simply setting the output pin to the corresponding value. When set to 0, no considerable pullup resistor is present on the bus and any week pull-up provided by the input pin is sunk through the output pin. Setting the output to 1 provides a sufficient pull-up indicating a 1 to the slave device. In order to read a value the output pin has to be set to 1.

The SHT11-Application

Unlike the I2C bus the SHT11 keeps the clock line at a low level and clocking is performed by a low-high followed by a high-low transition. Each transfer is initiated by sending a start condition followed by a combined address and command byte. Reading data is done by retrieving the level of the data line while the clock is at a high level.

While in conversion mode the SHT11 pulls the data line to 0 to indicate that no data is currently available.

The SHT11 supports fully static operation which means that there are no timing constrains regarding the clock frequency.

A detailed description of the bus and the commands available can be found in the SHt11 data sheet.

The example code is written in MS Visual Basic using the TraciiWork library.

All low-level routines defined in the Sensirion example code have been adapted for use with Tracii 400.

Two global variables (nData and nClock) are used to hold the logical output values of the SCL and SDA line. These values are transferred to the hardware using a dedicated routine (ChangePinState). This mechanism allows for potentially parallel operation of the test pins with a regular I2C application handled in the same code. It also helps to minimize time consuming calls to the Tracii 400 DLL.

Please note that this software is intended for demonstration purposes only and contains limited error checking.

In particular the clock status is not verified even though this would be possible with the hardware configuration. This means that the application will not recognize its inability to manipulate the clock line electrically.

Whilst the application displays the current Temperature, relative humidity and dewpoint, the sensor provides only the absolute humidity reading and the temperature. All other values are calculated in software. The dewpoint calculation in particular contains a rather sophisticated formula which is discussed in a separate application note provided by sensirion.