Bus Pirate (V3) talks to EEPROM

Published on Author Tomas StibranyLeave a comment

Recently I have been working with AVR XMEGA128A1 and I needed to use I2C (TWI) bus.
I also have some 24LC16b EEPROMs which are pretty easy to use, so I decided to use them
to test my I2C code. The code did not work on the first try (as expected) so I said, hey, let’s
try that I2C mode of the Bus Pirate so we know the EEPROM is not damaged.

At first I needed to connect my Bus Pirate to the EEPROM with the probe cable.

Gray = SDA
Purple = SCL

Then I fired up the terminal, entered the m (mode) command

BusPirateModes

Selected I2C

BusPirateI2Cmode

 

 

 

 

 

and finally set the speed to 100kHz.

Now we can talk to the chip.
I needed something very simple, only to verify that the chip is OK, so I wrote
random byte (I chose 0xAA) to the address 0x00 and read it back.

To write a byte to memory we need to enter this [0xA0 0x00 0xAA]
[         = Start bit
0xA0 = I2C address of the EEPROM with the WRITE bit
0x00 = Memory address
0xAA = Data
]          = Stop bit

BusPirateEEPROMwrite

 

 

 

 

 

 

Now we need to set the read pointer to address we want to read. This
is accomplished with this command [0xA0 0x00]
BusPirateEEPROMsetAddress

 

 

 

And at last we can read the byte stored at the address. [0xA1 r:1]
0xA1 = I2C address of the EEPROM with the READ bit set
r:1      = tells the Bus Pirate to read 1 byte
BusPirateEEPROMread

 

 

 

 

Here we see that we read 0xAA which is correct.

Mission accomplished!

Leave a Reply

Your email address will not be published. Required fields are marked *