Bus Pirate Beginner, can't read a register over I2C

Hacking multi-tool. Get one for $30, including worldwide shipping.

Bus Pirate Beginner, can't read a register over I2C

Postby silman » Tue Apr 11, 2017 10:38 pm

I just got a Bus Pirate 3.6 and am trying to get it to read from a Parallax L3G4200D Gyroscope.

I feel like i'm doing everything right but i am getting garbage back (with a NACK to boot).

I have I2C set up with pull-ups enabled and set high, Here is my power readout result

Code: Select all
    I2C>v
        Pinstates:
        1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
        GND     3.3V    5.0V    ADC     VPU     AUX     SCL     SDA     -       -
        P       P       P       I       I       O       I       I       I       I
        GND     3.31V   5.01V   0.00V   3.29V   L       H       H       H       H


Here is the datasheet for my gyro, see page 22 for I2C specification, and the devices SDO pin is held low so the when i do an I2C sweep i get the following

Code: Select all
    I2C>(1)
    Searching I2C address space. Found devices at:
    0xD0(0x68 W) 0xD1(0x68 R)



Now i simple do this command to read register 0x2D (Z gyro High Byte) but i'm not reading anything it seems. When i move the gyro it stays the same in any orientation. The command is START -> SLAVE ADDRESS -> REGISTER ADDRESS -> REPEATED START -> READ COMMAND -> BUS PIRATE READ -> STOP

Here is my command:

Code: Select all
    I2C>[ 0xd0 0x2d [ 0xd1 r ]
    I2C START BIT
    WRITE: 0xD0 ACK
    WRITE: 0x2D ACK
    I2C START BIT
    WRITE: 0xD1 ACK
    READ: 0xFE
    NACK
    I2C STOP BIT


EDIT: there was some pin configurations i hadn't set yet. Read your datasheets, kids.

Bus pirate rules. Mods can delete this thread please.
silman
Newbie
Newbie
 
Posts: 4
Joined: Sun Apr 09, 2017 8:35 pm

Return to Bus Pirate Support