I keep getting a NACK back from the LMP91000 using this code blow
#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);
}
}
if anyone is familiar using mbed would be great to know what the mistake is that I am doing. MENB is shorted pins 2/3 on the eval board.
Thanks.