Skip to main content
Visitor II
September 29, 2020
Solved

How to write data into st25dv04k using i2c ?

  • September 29, 2020
  • 2 replies
  • 984 views

i am trying to write data using i2cset function of linux but when i write 00 value to 0x01 and read same addreess it returns me 00 value.

root@var-som-mx6:~# i2cset -y 2 0x53 0x00 0x01

root@var-som-mx6:~# i2cdump -f -y 2 0x53

No size specified (using byte-data access)

    0 1 2 3 4 5 6 7 8 9 a b c d e f   0123456789abcdef

00: 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................

root@var-som-mx6:~#

    This topic has been closed for replies.
    Best answer by Ronald B.

    Hello Mpraj.19,

    From my understanding, you cannot use i2cset and i2cdump to consistently access the ST25DV-I2C memory, because this device requires 2 bytes for internal address (while these commands only accept 1 byte of register address).

    Maybe the first byte written of i2cset could be used as the 2nd addressing byte, but this trick cannot work for the i2cdump.

    Also, the ST25DV-I2C as an internal address counter and when you do an "i2cdump -f -y 2 0x53" you're actually reading from this internal address counter (and not from offset 0).

    Please note as well that after a write the internal address counter poinst to the next address after the one that was written.

    However I'm pleased to let you know that we just released the STSW-ST25DV007 software package providing a Linux user space driver for the ST25DV-I2C, available here:

    https://www.st.com/content/st_com/en/products/embedded-software/st25-nfc-rfid-software/stsw-st25dv007.html#overview

    This software package comes with a User Manual for easy ramp-up.

    Regards

    2 replies

    ST Employee
    September 29, 2020

    ​Hello,

    Please be aware that memory addresses are coded on 2 bytes in the ST25DV04K. You may try 0x53 0x00 0x00 0x01 (the 0x00 0x00 are the memory address pointer and 0x01 is the data to be written).

    Best regards.

    Ronald B.Answer
    Visitor II
    September 30, 2020

    Hello Mpraj.19,

    From my understanding, you cannot use i2cset and i2cdump to consistently access the ST25DV-I2C memory, because this device requires 2 bytes for internal address (while these commands only accept 1 byte of register address).

    Maybe the first byte written of i2cset could be used as the 2nd addressing byte, but this trick cannot work for the i2cdump.

    Also, the ST25DV-I2C as an internal address counter and when you do an "i2cdump -f -y 2 0x53" you're actually reading from this internal address counter (and not from offset 0).

    Please note as well that after a write the internal address counter poinst to the next address after the one that was written.

    However I'm pleased to let you know that we just released the STSW-ST25DV007 software package providing a Linux user space driver for the ST25DV-I2C, available here:

    https://www.st.com/content/st_com/en/products/embedded-software/st25-nfc-rfid-software/stsw-st25dv007.html#overview

    This software package comes with a User Manual for easy ramp-up.

    Regards