A. Sobich
A. Sobich

Reputation: 1

Reading data from sensor through NFC tag type 5 (NFC-V)

I wanna make application in Android Studio for reading data from RGB sensor ISL29125 through NFC tag type 5 (ISO 15693). NFC tag is connected to sensor using I2C bus. I’m using address command for peripheral transaction according to datasheet of the NFC tag. My code for address mode peripheral transaction is following:

     byte[] command = new byte[]{
                                             (byte)0x20, //Request flags (Address mode ON)
                                             (byte)0xA2, //PERIPHERAL TRANSACTION command
                                             (byte)0x2B, //Manufacter code byte
                                             (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, //UID
                                             (byte)0x00, //Parameter byte = Stop bit disabled
                                             (byte)0x03, //NI2CWR (Number of bytes to be written) = 3
                                             (byte)0x88, //I2C slave address (write)
                                             (byte)0x09, //I2C slaves' register address
                                             (byte)0x89, //I2C slave address (read)
                                             (byte)0x01, //NI2CRD (Number of bytes to be read) = 1
                                     };

                             System.arraycopy(id,0,command,3,8); //Change of UID to id of the tag
                             textView.setText("This is command you sent: "+(getHex(command)));

                        byte[] userdata= nfcvTag.transceive(command);
                        userdata = Arrays.copyOfRange(userdata, 0, 32);
                        viewResult.setText(getHex(userdata));

How the peripheral transaction command should look like according to datasheet

After sending this, I receive 32 times 0x00 byte, despite sensor is charged and the light goes to the sensor (RGB sensor). Anyway, there isn't mentioned where the slave address should be placed in the command in the datasheet of NFC tag (I incerted it almost at the end - bytes 88 09 and 89, but I'm not sure if it is right). Tag is MAX66242 and sensor is ISL29125 (https://www.intersil.com/content/dam/Intersil/documents/isl2/isl29125.pdf).

Reading sequence from sensor

I wanna to read data from register 0x09 (Green LOW).

My question is, does anybody know where the problem can be? And why do I reveice just 0x00? I think, the problem might be with inicialization. How could I do it, if I would like to try it?

Thank you for any advice.

Upvotes: 0

Views: 439

Answers (1)

I Don't know whether your question is still valid or just pending... Have you try to send a stop bit? That would be: (byte)0x10, //Parameter byte = Stop bit enabled instead of "(byte)0x00, //Parameter byte = Stop bit disabled" That might help to terminate a I2c sequence...

Upvotes: 1

Related Questions