cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot read chip ID for ST25R3918

Mihaita Ivascu
Associate III

Hello,

 

     I am trying to work with ST25R3918 part.

    I have followed the suggestion here: Solved: ST25R3918 - STMicroelectronics Community for firmware and example usage.

    The board itself is a NUCLEO-WL55JC1. I have tried both I2C and SPI communication but I cannot even read chip id reg(0x3F). According to the datasheet Datasheet - ST25R3918 - Multi-purpose NFC transceiver SPI/I2C should work even if the rfid is not in power wake up mode so reading the chip id register should be possible. ST32CubeIDE examples also seem to do the ID reading before any other configuration.

   I don't receive anything on SPI/I2C when reading that reg. 

   I would like to know if somebody which is familiar ST25R3918 is aware of any additional register configuration before being able to retrieve the chip id reg. 

 

Thanks,

      Mihai

 

1 ACCEPTED SOLUTION

Accepted Solutions

Actually the issue was that both Wire.endTransmission() and seemingly the st25r3918 driver from stm32cubeIDE are setting a STOP bit after first part of i2c transaction(when the master writes the register address it wants to read)

maybe repeated start is not implemented correctly in the driver. I will check it

Testing with Wire.endTransmission(false) helped me understand what the issue was

Thanks for the good tips. will close the topic

View solution in original post

9 REPLIES 9
Ulysses HERNIOSUS
ST Employee

Hello,

chip ID is always readable. IMO the only relevant conditions should be VDD_IO being present and chip being powered such that VDD_D is properly powered up (typically at 3.4V when 5V VDD are used).

Please verify the sent SPI waveforms and check the MISO pin to be high-ohmic from MCU side.

BR, Ulysses

 

Hello Ulysses,

We are using a NFC 5 Click board from Mikroelektronika, configured for I2C communication, 5V VCC and VIO. The power comes ok and we are currently testing with Arduino. Upon implementing the following code:

#include <Wire.h>

#define ST25R3918_I2C_ADDRESS 0x50  // 7-bit I2C address
#define DEVICE_ID_REG         0x3F  // Device ID register address

void setup() {
  Serial.begin(9600);
  Wire.begin();  // Join the I2C bus as a master

  delay(100);  // Small delay to allow the device to boot

  // Request to read the device ID
  for(int reg_add = 0; reg_add<=0x3F; reg_add++) {
 
  Wire.beginTransmission(ST25R3918_I2C_ADDRESS); // transmit to device #44 (0x2c)
  // device address is specified in datasheet
  Wire.write(byte(0x02));            // sends instruction byte
  Wire.write(byte(0xFF));            // sends instruction byte
  //Wire.write(byte(0x10));            // sends instruction byte
  Wire.endTransmission();     // stop transmitting
 
 
  Wire.beginTransmission(ST25R3918_I2C_ADDRESS);
  //Wire.write(DEVICE_ID_REG);  // Register address
  //Wire.write(ST25R3918_I2C_ADDRESS);
  Wire.write(reg_add);
  Wire.write(ST25R3918_I2C_ADDRESS);
  if (Wire.endTransmission(false) != 0) {  // Repeated start
    Serial.println("Failed to contact ST25R3918");
    return;
  }

  Wire.requestFrom(ST25R3918_I2C_ADDRESS, 5);  // Request 1 byte
  if (Wire.available()) {
    byte chipID = Wire.read();    
    Serial.print("ST25R3918 register 0x");
    Serial.print(reg_add, HEX);
    Serial.print(" value: 0x");
    Serial.print(chipID, HEX);
    Serial.print(" 0x");
    chipID = Wire.read();
    Serial.print(chipID, HEX);
    Serial.print(" 0x");
    chipID = Wire.read();
    Serial.print(chipID, HEX);
    Serial.print(" 0x");
    chipID = Wire.read();
    Serial.print(chipID, HEX);
    Serial.print(" 0x");
    chipID = Wire.read();
    Serial.println(chipID, HEX);
   
  } else {
    Serial.println("Failed to read chip ID");
  }
}

}

void loop() {
  // Nothing to do here
}
 
We get the following output:
 
ST25R3918 register 0x0 value: 0xFF 0x0 0xFF 0x8 0x0
ST25R3918 register 0x1 value: 0xFF 0x50 0xFF 0x8 0x0
ST25R3918 register 0x2 value: 0xFF 0x50 0x50 0x8 0x0
ST25R3918 register 0x3 value: 0xFF 0x50 0xFF 0x50 0x0
ST25R3918 register 0x4 value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0x5 value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0x6 value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0x7 value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0x8 value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0x9 value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0xA value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0xB value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0xC value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0xD value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0xE value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0xF value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0x10 value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0x11 value: 0xFF 0x50 0xFF 0x50 0x50
ST25R3918 register 0x12 value: 0xFF 0x50 0xFF 0x50 0x50
and it goes on to 0x3F in the same manner.
Do you know what could go wrong?
 
Thank you!
 
Best regards,
Dragos

Hi,

don't know this board in details. There was a similar topic some time ago. Maybe it helps:

 

https://community.st.com/t5/st25-nfc-rfid-tags-and-readers/st25r3916-not-responding-with-spi/m-p/78520

 

BR, Ulysses

Hello Ulysses,

 

Thank you for your reply. The board we are using is a simple breakout board for the ST25R3918 chip: https://www.mikroe.com/nfc-5-click

IO checked the issue above and it doesn't have common points with our issue: the electrical connections are very straight forward in our case, we are connecting GND, 3v3, 5v and I2C lines between the STM32 board and the NFC board.

 

Thank you!

 

Best regards,

Dragos

Brian TIDAL
ST Employee

Hi,

I believe the register read sequence is incorrect:

  Wire.beginTransmission(ST25R3918_I2C_ADDRESS);
  //Wire.write(DEVICE_ID_REG);  // Register address
  //Wire.write(ST25R3918_I2C_ADDRESS);
  Wire.write(reg_add);
  Wire.write(ST25R3918_I2C_ADDRESS);
  if (Wire.endTransmission(false) != 0) {  // Repeated start
    Serial.println("Failed to contact ST25R3918");
    return;
  }

Here is a typical read sequence:

BrianTIDAL_0-1747040613480.png

This reads the 4 interrupt registers 1Ah-1Bh-1Ch-1Dh

Make sure to follow the section 4.3.4 I2C interface from the Datasheet.

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello Brian,

 

     Thanks for your reply.

      Yes I have checked the datasheet and tried also with this sequence:

 

#define ST25R3918_ADDR 0x50  // Replace with actual I2C address
#define CHIP_ID_REG 0x3F     // Replace with correct register for chip ID
#define INIT_REG 0x02        // Example register for initialization
#define ST25R3918_CMD_MODE              (3U << 6)                      /*!< ST25R3918 Operation Mode: Direct Command                       */
#define ST25R3918_READ_MODE             (1U << 6)                      /*!< ST25R3918 Operation Mode: Read                                 */
 
Wire.beginTransmission(ST25R3918_ADDR);
  Wire.write(CHIP_ID_REG | ST25R3918_READ_MODE);  // Request chip ID register
  Wire.endTransmission();

  Wire.requestFrom(ST25R3918_ADDR, 1); // Request 1 byte
  if (Wire.available()) {  
    byte chipID = Wire.read();
    Serial.print("Chip ID: 0x");
    Serial.println(chipID, HEX);
  }
 
for using mode byte as well. I have checked st25r3916 drivers in stm32cube to see how to do it.
I am also using direct command C0 and C1 in order to have the chip  in ready or stable state:
 
#define ST25R3916_CMD_SET_DEFAULT 0xC1U /*!< Puts the chip in default state (same as after power-up) */
 
it seems that even though I set mode byte what I read is for situation described here:
MihaitaIvascu_0-1747060445757.png

so it seems mode byte is ommitted even though I set it

Brian TIDAL
ST Employee

Hi,

I would suggest to connect a logic analyzer or a scope on the SCL and SDA signals. Also, check the Wire.endTransmission() return code.

Rgds

BT

 

 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello BT,

 

    Thanks for the suggestions.

    Wire.endTransmission() returns 0 so it's ok.

    I can read chip ID reg(0x3F) and any reg for ST25R3918 but only in this mode(when doing a dump of registers):

MihaitaIvascu_0-1747163518226.png

even though I send byte mode according to the datasheet and the Wire.endTransmission() afterwards returns 0(transfer completed)

Actually the issue was that both Wire.endTransmission() and seemingly the st25r3918 driver from stm32cubeIDE are setting a STOP bit after first part of i2c transaction(when the master writes the register address it wants to read)

maybe repeated start is not implemented correctly in the driver. I will check it

Testing with Wire.endTransmission(false) helped me understand what the issue was

Thanks for the good tips. will close the topic