Skip to main content
Visitor II
November 26, 2021
Solved

Read ANT7-T-ST25DV04K data with MCU

  • November 26, 2021
  • 11 replies
  • 2230 views

Hi!

I am writing data to the ANT7-T ST25DV04K module from my mobile phone using an app. Now I would like to read that data stored in the ANT7-T ST25DV04K module with a microcontroller. The idea is to make a simple program that only reads the data from the module. What commands should I send to read its stored data?

    This topic has been closed for replies.
    Best answer by JL. Lebon

    Hello,

    The ANT7 board does not require anything special on the START bit, it is perfectly in the I2C specification, so I see no reason why it should be different from any other I2C device on this START condition...

    The problem looks to be more on the microcontroller side, since there is no action from the ANT7 part in the START bit. I'm sorry, but I'm not aware of how TI microcontroller works, so it is difficult for me to help. You may contact TI support for help on the MSP micro.

    One idea: is there pull-up resistors on the I2C bus on your microcontroller board ?

    The I2C bus requires pull-up resistors on the SDA and SCL signals. Those pull-up are not present on the ANT7 board, and must be added externally.

    So may be your microcontroller board doesn't have those pull-up resistors, which may explain your problem with START condition (and may be other boards you tested do have those pull-ups, which explains why they work)

    Best regards.

    11 replies

    ST Employee
    November 26, 2021

    Hello,

    You can read (and write) ANT7-T ST25DV04K module from a microcontroller using the I2C bus.

    I2C command to use are described in the ST25DV-I2C datasheet (https://www.st.com/resource/en/datasheet/st25dv04k.pdf) in chapter "6.5 I2C read operations" (you can see "Figure 29. Read mode sequences").

    For example, if you want to read 3 bytes at EEPROM memory address 0x0000, you can send the following I2C command: Start/0xA6/Ack/0x00/Ack/0x00/Ack/Start/0xA7/Ack/Byte 0/Ack/Byte 1/Ack/Byte 2/Nack/Stop

    Best regards.

    Ide c.1Author
    Visitor II
    November 26, 2021

    Hello,

    Okay, I understand more or less the idea. But I still have some doubts:

    • When you write "start" in the example, what do you mean? Is there a value equivalent to "start" or was it just to explain to me?
    • Ack is a value that I have to send in the command or that I have to read?
    • In the "Byte 1" slot I have to put 0x01?

    Thank you very much for your help and sorry for my inexperience,

    Best regards.

    ST Employee
    November 26, 2021

    Hello,

    • The "Start" in my example is for the I2C start bit. It is when the i2C data line goes low when the I2C clock line is high (same thing for the "Stop" bit, which is the opposite. Please refer to datasheet chapter "6.1 I2C protocol", it is all explained there.
    • The "ack" represent the acknowledge bit, which can come from the master or from the slave, depending on the direction of the data (in my example, the 4 first acks are coming from the slave device, the next 2 are coming from the master and the nack is coming from the master as well).
    • By "byte 1" I mean the byte value you are reading here. In my example, I'm reading 3 bytes, "Byte 0" Byte 1" and "Byte 2". It can be any value and are the data returned by the slave device.

    You can read the i2C specification which is public and free to understand better how I2C works, and you can probably easily find tutorials on how I2C works on internet as a good start.

    Nevertheless, it is most probable that there is already a library for your MCU that can handle directly all those I2C bits and bytes signaling hassle. Most of the MCUs do have I2C integrated IPs that silently manage all this and are provided with libraries to easily use the MCU's I2C bus. You may start by looking for this?

    Best regards.

    Ide c.1Author
    Visitor II
    November 30, 2021

    Hello,

    Thank you very much for the information, I understand how to do the communicate but I am having problems. 

    When I send the START condition code, the TXIFG flag should be activated to start sending the command through i2c. What happens is that the flag is not raised, so I can't send the commands and I can't configure it.

    I have tried the same code with other boards and it works, the problem is with the ANT7-T-ST25DV04K but I don't know how to solve it. Any recommendation?

    ST Employee
    November 30, 2021

    Hello,

    Can you please tell what microcontroller you are using exactly ? Which SW library you are using with it ?

    Best regards.

    Ide c.1Author
    Visitor II
    November 30, 2021

    Hello,

    Yes, I am using MSP430FR2433 with the "msp430.h" library.

    JL. LebonAnswer
    ST Employee
    November 30, 2021

    Hello,

    The ANT7 board does not require anything special on the START bit, it is perfectly in the I2C specification, so I see no reason why it should be different from any other I2C device on this START condition...

    The problem looks to be more on the microcontroller side, since there is no action from the ANT7 part in the START bit. I'm sorry, but I'm not aware of how TI microcontroller works, so it is difficult for me to help. You may contact TI support for help on the MSP micro.

    One idea: is there pull-up resistors on the I2C bus on your microcontroller board ?

    The I2C bus requires pull-up resistors on the SDA and SCL signals. Those pull-up are not present on the ANT7 board, and must be added externally.

    So may be your microcontroller board doesn't have those pull-up resistors, which may explain your problem with START condition (and may be other boards you tested do have those pull-ups, which explains why they work)

    Best regards.

    Ide c.1Author
    Visitor II
    November 30, 2021

    Hello,

    Thanks for the help, it seems that the error may be due to the lack of pull-up. Now the flag is activated and I can send the first byte. The problem now is that it only sends one byte, the flag is not activated again to send the next byte. I will keep looking for another solution to this, I understand that you can't help me more.

    Best regards.

    ST Employee
    November 30, 2021

    Good!

    I'm glad I could help you progress in your project :)

    Best regards.

    Ide c.1Author
    Visitor II
    December 2, 2021

    Hi!

    Yesterday you helped me to solve some problems I had with the ANT7-T-ST25DV board. I have new doubts that I would like you to solve:

    • I want to configure the board to do energy harvesting through NFC. I would like to send the command through the application "ST25 NFC TAP". Which is the correct command to send? The ones I have tried do not work...

    • On the other hand, to write a register in the ST25DV memory, what character should I write so that it is saved as 0xFF? for example, when I write FF it is saved as 0x46...

    Thank you for the help,

    Best regards.

    ST Employee
    December 2, 2021

    Hello,

    For energy harvesting, there is two ways of enabling energy harvesting:

    • Enabling EH automatically as soon as the RF field is present. This is done by writing static system configuration register EH_MODE to value 0x00. This register is non volatile and value will remains between power cycles.
    • Enabling EH "on-demand" each time you need it. This is done by writing dynamic register EH_CTRL_Dyn to value 0x01. This register is volatile and value willbe reset to 0 during power cycles (so next boot, the EH will be disabled).

    In ST25 NFC TAP app, you can activate EH by going in the left menu and select "Register Management" if you want to write the EH_MODE register (permanent EH) or select "Dyn Register Management" if you want to write into EH_CTRL_Dyn register (temporary EH).

    Concerning write into a register:

    • for static system configuration registers, you must first present a password to allow write access. If write register from I2C, you must first present the i2C password. If write from RF, you must first present the RF configuration password (Password 0). This may be your issue here.
    • For dymanic registers, no need for a password.

    All those points are clearly explained in the different documents publicly available on ST's web site (datasheet, application notes, etc.). Probably having a look at those docs would make your life easier.

    Best regards.