【发布时间】:2025-11-28 11:40:01
【问题描述】:
我用 STM32L031K6 和 ST25DV64K NFC 芯片制作了自己的开发板。我正在使用安卓应用程序“NFC 工具”。我可以使用应用程序读取 NFC 芯片的 UID,因此天线已正确调谐。我还可以通过 I2C 总线使用微控制器读取 UID。当我用微控制器写入 NFC 芯片的 eeprom 存储器时,我无法用 NFC 应用程序读取数据。它说标签是空的。我想我缺少一个配置,但我找不到哪个配置。
这是我的代码,执行一次:
uint8_t ToWrite = 15;
uint8_t Password[17] = {0}; //Default password is"00000000"
Password[8] = 0x09; //Validation Code
// ST25DV_Address_E21 0x57 << 1; // Device select code= 0b1010111 ; E2 = 1
Password_Address = 0x900
HAL_I2C_Mem_Write(&hi2c1, ST25DV_Address_E21, Password_Address, 2, Password, 17, 0xFFF);
HAL_Delay(200);
//Read the UID
HAL_I2C_Mem_Read(&hi2c1, ST25DV_Address_E21, 0x18, 2, UID_Read, 8, 0xFFF); // This line works, UID displayed in the app and in the debugger are the same
HAL_Delay(500);
//Write some data in the eepprom memory (first address: 0x00)
for(int i = 0; i< 250; i++)
{
ToWrite++;
HAL_I2C_Mem_Write(&hi2c1,ST25DV_Address_E21, i, 2, &ToWrite, 1, 0xFF);
}
【问题讨论】: