9 years, 7 months ago.

mbed on Redbear Ble nano with LMP91000 Eval Board I2C not working

I am not sure what I am missing using the I2C mbed library. But i keep getting a NACK back from my i2c.read().

#include "mbed.h"

I2C i2c(p10, p8)

char data[1];
char statusAddr [1];

const int addr = 0x90 //shifted from 0x48 7bit to 8bit addr
int returnVal;

Serial pc(USBTX, USBRX);

int main() {

    pc.baud(9600);
    wait(5);
    i2c.frequency(100000);

    statusAddr[0] = 0x00;

    while(1)   {
        i2c.write(addr, statusAddr, 1, True); //Write to register to read from
        returnVal = i2c.read(addr, data, 1); //read actual data from register
        pc.print("the value is :%d\r\n", returnVal); //should be getting 0 for ACK, non zero is NACK.
        wait(1);
    }
}

Eval Board guide www.ti.com/lit/ug/snau121a/snau121a.pdf

Datasheet LMP91000 http://www.ti.com/product/LMP91000/datasheet go under detailed description >> Programming >> I2C interface

Thanks!

Be the first to answer this question.