NT3H2211 NTAG I2C Plus won't read/write registers over I2C

显示  仅  | 搜索替代 

NT3H2211 NTAG I2C Plus won't read/write registers over I2C

560 次查看
Contributor I

Greetings everyone,

As the title says, I have issues with NT3H2211W0FTTJ NTAG. 

I am currently using STM32L010 MCU, and I am trying to port the official library from NXP to work on my MCU.

My original reference library is from here (SW3647 > workspace_ntag_i2c_plus): https://www.google.com/search?q=om5569%2Fnt322erm&oq=om&aqs=chrome.1.69i57j69i59l2j0i131i433j46i131i...




In my code, I have tested I2C Communication, and I get HAL_OK responses for the following code, meaning that I2C is OK communication-wise:


#define NTAG_I2C_READ 0xAB
#define NTAG_I2C_WRITE 0xAA

result = HAL_I2C_IsDeviceReady(&hi2c1, NTAG_I2C_READ, 2, 5);
if (result == HAL_OK) PRINTF("READ ADDRESS OK!\r\n");
result = HAL_I2C_IsDeviceReady(&hi2c1, NTAG_I2C_WRITE, 2, 5);
if (result == HAL_OK) PRINTF("WRITE ADDRESS OK!\r\n");*/





The problem I get is, from the following code I get READ2 FAILED (these functions are from the reference library):


uint8_t NTAG_ReadRegister(NTAG_HANDLE_T ntag, uint8_t reg, uint8_t *val) {
ntag->tx_buffer[TX_START + 0] = NTAG_MEM_BLOCK_SESSION_REGS;
ntag->tx_buffer[TX_START + 1] = reg;

/* send block number */
if ( HAL_OK != HAL_I2C_SendBytes(ntag->i2cbus, ntag->address, ntag->tx_buffer, 2))
ntag->status = NTAG_ERROR_TX_FAILED;

return 1;

/* receive bytes */
if ( HAL_OK != HAL_I2C_RecvBytes(ntag->i2cbus, ntag->address, ntag->rx_buffer, 1))
ntag->status = NTAG_ERROR_RX_FAILED;

return 1;

*val = ntag->rx_buffer[RX_START + 0];
return 0;





The problem lies in the HAL_I2C_RecvBytes function

I have tried to port the following functions to STM32 (these are not from the reference library):


HAL_StatusTypeDef HAL_I2C_RecvBytes(uint8_t i2cbus, uint8_t regAddress, uint8_t *byteData, uint8_t len)

return HAL_I2C_Master_Receive(&hi2c1, NTAG_I2C_READ, byteData, len, 100);




HAL_StatusTypeDef HAL_I2C_SendBytes(uint8_t i2cbus, uint8_t regAddress,uint8_t *dataToWrite, uint8_t len)
return HAL_I2C_Master_Transmit(&hi2c1, NTAG_I2C_WRITE, dataToWrite, len, 100);





Sorry for the long post, I was hoping if someone has good advice on how to make it work on STM32.
Any help is really appreciated

标记 (1)
0 项奖励
1 回复

549 次查看
NXP TechSupport
NXP TechSupport


One may refer to  the document (it is NXP MCU)as the link. 


Have a nice day.


- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

0 项奖励