cancel
Showing results for 
Search instead for 
Did you mean: 

Read ANT7-T-ST25DV04K data with MCU

Ide c.1
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions
JL. Lebon
ST Employee

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.

View solution in original post

12 REPLIES 12
JL. Lebon
ST Employee

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.1
Associate II

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.

JL. Lebon
ST Employee

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.1
Associate II

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?

JL. Lebon
ST Employee

Hello,

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

Best regards.

Ide c.1
Associate II

Hello,

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

JL. Lebon
ST Employee

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.1
Associate II

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.

JL. Lebon
ST Employee

Good!

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

Best regards.