Skip to main content
Visitor II
July 24, 2025
Solved

I2C communication is not working between ST25R3916B and MCU STM32G0B1RT6N

  • July 24, 2025
  • 4 replies
  • 1462 views

Hi I am using ST25R3916B as NFC reader and it is interfaced with STM32G0B1RT6N via I2C lines. I am not able to communicate with reader IC . I have checked I2C_EN line is connected to VDD_D voltage output from reader IC. it is 2.05V and SCL and SDA lines are pulled  up to 3.3V with 10K resistor.

Pls help me where i am doing wrong

    This topic has been closed for replies.
    Best answer by Ulysses HERNIOSUS

    Hi, 

    as per DS you need to use a repeated Start condition. Here you are showing Stop condition followed by Start condition.

    Maybe also refer to https://community.st.com/t5/st25-nfc-rfid-tags-and-readers/errors-while-compiling-the-fw-stsw-st25r011-of-the-st25r3916/m-p/69192?lightbox-message-images-69200=9653i4AD55C02C4B0012C

     

    Ulysses

    4 replies

    Super User
    July 24, 2025

    @Dilip wrote:

     SCL and SDA lines are pulled  up to 3.3V with 10K resistor.


    That's rather high - try something more like 2k7.

    Look at the I2C lines using an oscilloscope: are the waveforms OK - especially the rising edges?

    See: https://electronics.stackexchange.com/a/473799

    Once the waveforms are OK in the analogue domain, use a logic analyser to see what's happening at the I2C protocol level...

     


    @Dilip wrote:

    I am not able to communicate with reader IC .


    What, exactly, do you mean by that?

    How to write your question to maximize your chances to find a solution

    Technical Moderator
    July 24, 2025

    Hi,

    sounds about right what you are doing. Please provide scope shots and logic analyzer traces of what you are doing. First step should be reading the IC Identity register: Send 0x7f to the device and do a repeated start and read one byte. Is the address being ACK'ed? What data do you get? How does this look on analog SDA/SCL? 

    More information required to analyze.

    Ulysses

    DilipAuthor
    Visitor II
    July 24, 2025

    Hi Ulysses, 

    I dont how to read to IC identity register because I2C communication is not working. Right now both SCL and SDA lines logic high 3.3V on oscilloscope.

     

    Super User
    July 24, 2025

    So you have a basic problem with your STM32 configuration and/or your hardware.

    Please give details of your hardware.

    have you tested your STM32 I2C on an ST board?

    have you tried ST's I2C examples?

    Can you drive the lines high and low just using basic GPIO?

     

    Again, see: How to write your question to maximize your chances to find a solution

    ST Employee
    July 25, 2025

    Hello Dilip,

    around 2.05V is the VDD_D supply in power down mode. It should be 2.95 or 3.0 when the chip is supplied via VDD=3.3V  and the enable bit is set.

    BR Travis

    Super User
    July 25, 2025

    But would that explain no activity at all on the I2C lines?

    Surely, even if the ST25 is in power-down, @Dilip should still see the Master (STM32) clocking-out the address?

    ST Employee
    July 25, 2025

    Yes, exactly.

    When the ST25 is in power down mode, we should still be able to see the master frames.

    Also the Power Down registers can be written and read out in this state (like the operation control register)

    To analyze further we would need analog (e.g. scope shots) and digital traces (digiview traces) of the SPI communication. 

    BR Travis

    Technical Moderator
    August 4, 2025

    Hi,

    Reading space A or space B register on I²C behaves the same way regarding the repeated start. See figure 24 in the ST25R3916B datasheet.

    The code supporting I²C is available in the X-CUBE-NFC6 package and the ST25R Embedded library (files i2c.h and i2c.c). These packages provide the RFAL NFC communication stack, the ST25R3916B driver, and some demos. Using the X-CUBE-NFC6 package (or the ST25R Embedded library) is encouraged rather than developing code from scratch.

    Rgds

    BT

    DilipAuthor
    Visitor II
    August 18, 2025

    Hi Brian, 

    I have used X-CUBE-NFC6, in which i am using NFC08A1 with I2C option. I have used this as software pack with STM32G0B1RBT6N MCU in cubeMX and generated the code. This code is showing different errors while making build file. Mostly errors are in demo_polling.c and rafal_plateform.h files. 

    Errors are in this function :   platformLedOn( ((nfcDevice->type == RFAL_NFC_POLL_TYPE_NFCA) ? PLATFORM_LED_A_PORT : PLATFORM_LED_F_PORT),

    and 

    HAL_GPIO_WritePin(port, pin, GPIO_PIN_SET) /*!< Turns the given GPIO High */

     I am adding here zip file for my whole code, Can you pls help me to build file from this code?

     

    Technical Moderator
    August 20, 2025

    Hi Dilip,

    this is code for handling LEDs connected to the MCU. In case you don't have them then you may need to dummy define these macros or put them to the same dummy pins. I assume you lack definitions for PLATFORM_LED_A_PORT and/or PLATFORM_LED_F_PORT. 

    BR, Ulysses