chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 556 forks source link

Can not read more than 32 multiple block #337

Closed marioshtika closed 5 years ago

marioshtika commented 5 years ago

Hello Don,

I am trying to read multiple blocks (all of them) from a device with nfc-v with m24lr chip.

let writeData = new Uint8Array(5);
writeData[0] = 0x0A; // Flags
writeData[1] = 0x23; // Read multiple block
writeData[2] = 0x00; // Address of starting block (first 8bit) 
writeData[3] = 0x00; // Address (second 8bit)
writeData[4] = 0x1F; // Numbers of block (0x20 is not working)
nfc.transceive(writeData.buffer)
  .then(response => {
    console.log('response: ' + response);
  })
  .catch(error => {
    console.log('error transceive: ' + JSON.stringify(error));
  });

If I am asking for 32 blocks it works well, if I as for 33 it sends me an error

Is there anything I am doing wrong or is it some problem with the plugin?

Thank you in advance.

marioshtika commented 5 years ago

Some one helped me with the answer in stackoverflow. So I am writing it here and answering my own question to help others.

See the datasheet (M24LR64-R: Dynamic NFC/RFID tag IC with 64-Kbit EEPROM with I²C bus and ISO 15693 RF interface, DocID15170 Rev 16, section 26.5; the same also applies to M24LR64E-R, M24LR16E-R, and M24LR04E-R):

The maximum number of blocks is fixed at 32 assuming that they are all located in the same sector. If the number of blocks overlaps sectors, the M24LR64-R returns an error code.

Thus, the READ MULTIPLE BLOCKS command for these chips is limited to 32 blocks.