You only need your twi write to be one byte long (0x00).
Also make sure to check the return value of writeRead
On Mar 19, 2014 2:29 PM, "Santiago Alfaro" <[email protected]> wrote:

> Hello All
>
> I'm starting to get a handle on TWI on the ioio but I have not been able
> to get an EEPROM dump from this sensor.
>
> The datasheet for the sensor can be found here
> http://www.melexis.com/MLX90620
>
> and what I think are the relevant parts of it are these:
>
>
> <https://lh4.googleusercontent.com/-DQO16I0bc_8/UyoLocosLAI/AAAAAAAAFU4/Df0qFbs20Xo/s1600/EEPROM.png>
>
> and
>
>
>
> <https://lh4.googleusercontent.com/-D2PP5yuAifY/UyoKBahwBOI/AAAAAAAAFUs/5NfmDToaRdc/s1600/ExportWholeEEPROM.png>
>
>
> The code I have so far is this:
>
>
> *  twiEeprom = ioio_.openTwiMaster(0, TwiMaster.Rate.RATE_400KHz, false);*
>
> *     ...*
>
> *     ReadEeprom(0x50, twiEeprom);*
>
> *     ...*
>
> *     public void ReadEeprom(int address, TwiMaster port) {*
>
> * byte[] request = new byte[] { 0x00, 0x50 }; //Byte address to ask for
> sensor data*
>
> * byte[] response = new byte[ 0xFF ]; //Byte to save sensor data*
>
> * try {*
>
> * Log.d(TAG, ":| Trying to read");*
>
> * port.writeRead(address, false,
> request,request.length,response,response.length);*
>
> * for(int i=0; i<response.length; i++){*
>
> * Log.i(TAG, "EEPROM Dump "+i+" = "+ response[i]);*
>
> * }*
>
> * Log.d(TAG, ":) success reading");*
>
> *     ...*
>
> My problem is that I keep getting all zeros on the EEPROM Dump. I know I'm
> correctly connected because it works on an Arduino. (also because I already
> burnt a IOIO trying to figure another thing out :D but now the new one is
> surviving )
>
>
> Is there anything that jumps out that I'm doing wrong? I can send more
> detail if needed.
>
>
> Thanks,
>
> Santiago
>
>  --
> You received this message because you are subscribed to the Google Groups
> "ioio-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/ioio-users.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to