Skip to main content
EBen-
Associate
March 27, 2020
Solved

how to communicate with M24LR04 via I2c

  • March 27, 2020
  • 2 replies
  • 1226 views

Im sending the "Get System Info" command to check receiving data correctly from the M24LR04 via I2C.

The packet that I sending is {0x00 (request flags), 0x2B(get system info command), 0xF6 (CRC LSB), 0x75 (CRC MSB) }

the response that I get is 0xFF for all.

I'm using the STM32F031 MCU and keil IDE

also using the functions HAL_I2C_Master_Transmit / HAL_I2C_Master_Receive from the stm32f0xx_hal_i2c.c library.

I have on the same board another chip connecting to SDA/SCL lines and I manage to communicate with successfully.

code example:

uint8_t buffTx[4] = {0x00,0x2B, 0xF6 , 0x75 };

HAL_I2C_Master_Transmit(&hi2c1, M24LR_Add, buffTx, 4, 10);

HAL_I2C_Master_Receive(&hi2c1, M24LR_Add, dataBufferAdd, 8, 10);

Any help would be appreciated.

Thanks!

    This topic has been closed for replies.
    Best answer by Rene Lenerve

    Hi @EBen-​ ,

    Are you sure this is a M24LR04 and not an M24SR, because for the M24LR, the get system info command is used only for RF side not with I²C. To access these information you just have to read registers in the system area (E2=1) at address 2332. You can check registers in the datasheet p30 https://www.st.com/content/st_com/en/products/nfc/st25-nfc-rfid-tags-readers/st25-dynamic-nfc-tags/m24lr-series-dynamic-nfc-tags/m24lr04e-r.html.

    Hope this can help you.

    Best Regards.

    2 replies

    Rene Lenerve
    Rene LenerveBest answer
    ST Employee
    March 27, 2020

    Hi @EBen-​ ,

    Are you sure this is a M24LR04 and not an M24SR, because for the M24LR, the get system info command is used only for RF side not with I²C. To access these information you just have to read registers in the system area (E2=1) at address 2332. You can check registers in the datasheet p30 https://www.st.com/content/st_com/en/products/nfc/st25-nfc-rfid-tags-readers/st25-dynamic-nfc-tags/m24lr-series-dynamic-nfc-tags/m24lr04e-r.html.

    Hope this can help you.

    Best Regards.

    EBen-
    EBen-Author
    Associate
    March 28, 2020

    Thank you @Rene Lenerve​ for pointing me the right direction and also for your quick reply!. Its working now.

    Your help is much appreciated!

    Regards :)