Temperature sensor with Actel IGLOO

Overview
This design reads the temperature from a Microchip MCP9803 temperature sensor connected to the GPIO pins of the board. The temperature value read is then converted to BCD representation so that it can be displayed on the Pacer OLED display. Both the temperature sensor and the display have an I2C interface.
Supporting documentation
The documentation for the Microchip MCP9803 temperature sensor can be found here.

Actel provides the Pacer OLED display PMO13701 documentation with its kit. The Pacer documentation indicates that the display driver chip is a Solomon Systech SSD0300.
Design
Here is the design diagram:

ethernet design diagram

I2C

Both the temperature chip and the display use an I2C interface. Refer to the I2C standard and the temperature sensor documents.

The I2C interface is a serial interface with two wires. One is the clock (scl) and the other is data (sda). When transmitting data, sda must always change when scl is low. This is because any data change when the clock is high is interpreted as a start (when sda transitions from high to low) or a stop (when sda transitions from low to high).

The diagram above shows the main aspects of the communication. Notice in particular the starts and ends and also the start that follows immediately the ack. The Microchip temperature sensor document is excellent and has a complete description of the I2C sequences needed to interface with their chip.

I2C controller

The key to the I2C controller module implementation is to divide the design input clock (20Mhz) appropriately. The clock is first divided into 64 because the I2C interface requires a slower clock. For this we generate pulses at the appropriate intervals. These pulses are then counted in order to further divide the clock into four phases. This further division makes it possible to generate the appropriate sda clock transitions during the time when scl is low or high.

Temperature read

The temp_read module interfaces with the I2C controller in order to generate the appropriate sequences to configure the temperature chip and read the temperature value from the temperature register. Set to a 12-bit precision, the 16-bit temperature register yields the sign (1 bit), the integer value (7 bits) and the fractional value (4 bits) of the temperature. Once the read has been done, these values are available as outputs of the module.

Temperature to character conversion

The temp2char module takes the output of temp_read and converts it into binary coded decimal (BCD) values. The module takes as input an address which is the offset into the five BCD digits. The digit corresponding to the offset is presented as output to the display module.

Display

The i2c_display module uses another instance of the I2C controller to control the OLED display. After initialization, the module loops through the various character display positions. At each position the character to be displayed is fetched from the pacer_font8x16 module. The latter is a simple lookup table. The characters are stored in bitmap format with the 8x8 upper part of the character stored before the 8x8 lower part of the character. This is convenient because the interface of the display divides the 16-bit columns into an 8-bit upper part and an 8-bit lower part. Each time an upper part is written, the next write position is automatically incremented in the configured direction (left to right in this case).

Using the design
  • Connect the temperature sensor chip to the board
  • Modify the constraints accordingly to the connections
  • Create a Designer project with the provided files
Design files
actel_temp_read.zip