6 years ago.

I2C on Nordic NRF52_DK

I have the NRF52_DK board, and am successfully programming it with mBed. However, I seem to be having some trouble with the I2C interface.

On the board, the pins are P0.27>SCL and p0.26>SDA.

I2C i2c(p26, p27);
char cmd[4];
    // {0x22, 0x00, 0x08, 0x2A}
    cmd[0] = 0x22;
    cmd[1] = 0x00;
    cmd[2] = 0x08;
    cmd[3] = 0x2a;
    i2c.write(addr, cmd, 4);
 
    wait(0.5);
 
    cmd[0] = 0x00;
        //i2c.write(addr, cmd, 1);
    i2c.read(addr, cmd, 4);
    for(int x = 0; x < 4; x++){
        printf("Read: %d\n", cmd[x]);
    }

What I don't see is any activity on the I2C pins. I have a scope hooked up to them, and they are pulled high, but nothing else.

Ideas? dg

Figured it out. I had failed to shift the address. Feeding it an 8-bit address instead of a 7-bit address caused the trouble.

posted by David Simmons 12 Apr 2018
Be the first to answer this question.