Tag Archives: 24aa02
The Bus Pirate Demo Board has five I2C devices: two 24AA02 EEPROMs (2 KBit), one TC74 temperature sensor, one MCP4725 D/A Converter, and one DS1307 Real-Time Clock. This post is about the EEPROMS and the TC74 – next week’s post will be about the D/A converter and the RTC.
Pull-up Resistors & Connections
One thing that is not documented well enough for non-engineers is the pull-up resistors. They are pretty important for I2C devices and results can be weird. What needs to happen is to have BOTH the 5V and pull-up lines to the Vin pin on the demo board. I used a breadboard for now, although I have a different Bus Pirate cable on the way to make this a little easier.
In both the cases in this post, the CLK pin on the Bus Pirate gets connected to the SCL pin on the demo board and the MOSI pin on the Bus Pirate gets connected to the SDA pin on the demo board.
EEPROMs
Both of the EEPROMs are interfaced the same way.
Search for the EEPROM Addresses:
(1) is the address search address
[0xa0 0 3 2 1] – 0xa0 is the address to write to, 0 is the location in that address (the top), and 3, 2, and 1 are the values being written.
[0xa0 0][0xa1 r:3] – 0xa0 is the address, 0 is the location in the address. 0xa1 is the read command, and r:3 indicates to read three bits.
[0xa0 0xfa][0xa1 r:6] – this is to read a MAC address from the chip. Unfortunately, I can only seem to get all F’s from these chips… I’m not sure if I’m doing something incorrect or if the chip’s spec has changed since the instructions on Dangerous Prototypes were written.
As a final test, I cut the power to the board (w) and turned it back on (W) and read the chip to see if the values were still there. They were.
TC74 Temperature Sensor
The TC74 Temperature Sensor is an interesting device to use.
(1) – standard address search macro
[0x9a 1] – 0x9a is the address, 1 is a value to write. We don’t really care what it writes, we just need to do this to read the chip.
[0x9a 0][0x9b r] = 0x9a is the write address, 0 is a partial command to select the temperature register, and 0x9b r reads the register.
The value returned is 0x16, which is 22°C, or 71.6°F.
…next week – more I2C goodness!
-73-