Skip to main content
Explorer
October 11, 2024
Solved

ST25R3916 - I2C Issue

  • October 11, 2024
  • 1 reply
  • 1027 views

Hi everyone,

I'm currently working on reading and writing the registers of the ST25R3916 chip, which is mounted on the NFC08A1 board. However, I'm running into some issues with the I2C read and write operations.

Below is the code I'm using to attempt reading from the chip:

 

while (1)
 {
 uint8_t value = 0;
 HAL_StatusTypeDef status;
 status = HAL_I2C_Mem_Read(&hi2c1, ST25R_ADDR, 0x000C, I2C_MEMADD_SIZE_16BIT, &value, 1, 1000);

 switch(status){
 case HAL_OK:
 UART1_WriteString("HAL_OK I2C\r\n");
 break;

 case HAL_ERROR:
 UART1_WriteString("HAL_ERROR I2C\r\n");
 break;

 case HAL_BUSY:
 UART1_WriteString("HAL_BUSY I2C\r\n");
 break;

 case HAL_TIMEOUT:
 UART1_WriteString("HAL_TIMEOUT I2C\r\n");
 break;
 }
 }

 

For reference, "ST25R_ADDR" = 0x50.

When I flash the micro (NUCLEO-U575IQ), the code keeps printing HAL_ERROR on the serial monitor, and I can't figure out why.

From the ST25R3916 datasheet, I see that the I2C address is supposed to be 0x50, and I'm simply trying to read from the register at address 0x000C (or other registers).

Can anyone help me figure out what might be going wrong with this I2C communication, or if there is any additional configuration needed to successfully read or write to the ST25R3916 registers?

Thanks in advance!

 

 

 

 

    This topic has been closed for replies.
    Best answer by Brian TIDAL

    Hi,

    the X-NUCLEO-NFC08A1 default hardware configuration for the communication interface is SPI. See 

    User Manual UM2616 for the HW modification to enable I2C communications.
     
    The X-CUBE-NFC6 firmware package supports the I2C communication mode by simply selecting I2C while configuring the X-CUBE-NFC6 component in STM32CubeMX:
    BrianTIDAL_0-1728639632491.png

    This will then generate the application with the proper I2C API calls.

    I also suggest to connect a logic analyzer on SDA an SCL to debug easily.

    Rgds

    BT

    1 reply

    Technical Moderator
    October 11, 2024

    Hi,

    the X-NUCLEO-NFC08A1 default hardware configuration for the communication interface is SPI. See 

    User Manual UM2616 for the HW modification to enable I2C communications.
     
    The X-CUBE-NFC6 firmware package supports the I2C communication mode by simply selecting I2C while configuring the X-CUBE-NFC6 component in STM32CubeMX:
    BrianTIDAL_0-1728639632491.png

    This will then generate the application with the proper I2C API calls.

    I also suggest to connect a logic analyzer on SDA an SCL to debug easily.

    Rgds

    BT