Here is where I keep getting into trouble.
I've tried with 0x00 meaning that
byte[] request = new byte[] { 0x00 }; //Byte address to ask for sensor data
but that gives me an EEPROM dump of 0 and I know that is not right.
I added the "0x50" on the request byte because I figured I was doing
something wrong and on the Datasheet it shows that EEPROM Dump has the
Slave Address and a Write, then the command (0x00) and then the
slaveaddress (again) and a Read so since just 0x00 was not working I tried
that and won't work either.
How do I check for the return value of writeRead? won't that be the actual
EEPROM Dump that I get with the for loop?
also, in the arduino code I can use this line i2c_start_wait(0xA0); which
Issues
a start condition and sends address and transfer direction. If device is
busy, use ack polling to wait until device is ready is there a way to do
this with the ioio?
Lastly, in playing with variables and trying things I realized that if I
have the response byte be { 0xFF } my EEPROM dump will be all 0. But if I
change the response Byte to { 0x7F } then I get a bunch of numbers. I don't
understand why the length of the response byte changes the values of the
response.
Thanks
Santiago
On Wednesday, March 19, 2014 5:58:11 PM UTC-4, Ytai wrote:
>
> 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]<javascript:>>
> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> 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.