Thomas J

Member Since: November 12, 2009

Country: United States

  • Product SEN-10955 | about a year ago

    Has anybody been using this with Netduino? I can only partly access the registers. Following are some parts of the code I wrote:

    // Freescale MMA8452Q I2CDevice.Configuration Conf = new I2CDevice.Configuration(0x1D, 50); I2CDevice icD = new I2CDevice(Conf);

            byte[] data = new byte[7];
    

    // Set it Active (This part works correctly) I2CDevice.I2CTransaction[] writeTransaction = new I2CDevice.I2CTransaction[] { I2CDevice.CreateWriteTransaction(new byte[] {0x2A, 0x01}) }; int bytesWritten = icD.Execute(writeTransaction, 50);

    // Try to read Device ID (This part does not work correctly) I2CDevice.I2CTransaction[] rwtransaction = new I2CDevice.I2CTransaction[2] { I2CDevice.CreateWriteTransaction(new byte[1] { 0x0D }), I2CDevice.CreateReadTransaction(data)

                };
            int bytesRead = icD.Execute(rwtransaction, 50);
            Debug.Print(ByteToInt(data[0]).ToString());
    

    It seems that the read register is not set to 0x0D, but that it is set to 0X00, hence the byte array “data” contains the content of the registers starting at 0X00.

    Has anybody made the same experiences and found a way how to address this?

    Thanks - Thomas

No public wish lists :(