10 years ago.

I2C on FRDM-K64F

I'm having trouble getting I2C on the K64F to work. I've got code that runs happily on the LPC-1789:

bool initIMU(){
    char rx, tx[2], address;
//See if we can find the IMU
    pc.printf ("IMU acquisition test\r\n\r\n");
    address = L3GD20_ADDR;
    tx[0] = L3GD20_WHO_AM_I;
    v2.write(address,tx,1);
    v2.read(address+1,&rx,1);
    if(rx==212) pc.printf("Found gyroscopes\r\n",rx);
    else return false;

But on the K64F it doesn't. Am I missing a trick?

1 Answer

10 years ago.

There have been some issues reported with I2C, which are at least on my todo list, but dunno when I have time/interest in it.

In the meantime for the K64F try to go two revisions of the mbed lib back (89 iirc), and see if that solves the issue. Btw for read/write you don't have to use address + 1, the lib does it automatically for you (it also won't hurt though).