I am using the OM2NTP5332 eval board to test whether I can power a sensor using the energy harvesting feature of the NTP5332. I have hooked it up to an Arduino Uno for testing. It acts as the I²C master for configuration, as well as the "sensor" slave. I have also written a tiny Android application for my test phone.
The Arduino software configures the following using I²C:
- Unlocking all memory sectors by setting NFC_LOCK_0, NFC_LOCK_1, I2C_LOCK_0 and I2C_LOCK_1 to all 0s
- "Destroying" the Capability container by setting 0xAA55AA55 at location 0x0000
- Setting the configuration memory to 0x0892FF00 at location 0x1037. This, to my knowledge:
- enables ARBITER_MODE regardless of energy harvesting state
- sets the device to be in "I²C Master" mode
- uses SRAM as volatile memory and enables it
- Sets data transfer direction to go from I²C to NFC (sensor to NTP5332)
- Enables "Extended commands"
Then, it goes into "slave mode" and awaits I²C read requests, emulating a sensor I want to read. The android application simply waits for an NFC tag to be discovered, checks for NFC 5 support and then sends custom commands using byte buffers. I have used SW5870 for reference. This, for the most part, works. However, I cannot get the READ I2C and WRITE I2C commands to work.
I can read and write both SRAM and configuration memory using both I²C and NFC, so I know my hardware setup is sound. According to AN12368, all requirements for these two commands to work are fulfilled, judging from the readouts of the configuration memory. All I get on the android side is the response 0x010F, which, if I understand correctly, just signals there is an error and that the error code is 0x0F. This, in turn, is called an "unknown error" in the datasheet, which is not helpful at all. I can verify using an oscilloscope that the SDA and SCL lines don't even budge and remain high due to the external pullups.
I have tried many different configurations and combinations of configuration values, to no avail. I'd appreciate it if someone more familiar with this chip could help me out on this or give me a pointer.
Here's the byte buffers for both the READ and WRITE commands:
val write_i2c_cmd = ubyteArrayOf(
0x12u, // flags
0xD4u, // WRITE I2C constant
0x04u, // manufacturer code
0b00001000u, // I2C address
0x00u, // N-1 bytes to write
0x00u // single, empty data byte
).toByteArray();
val read_i2c_to_sram_cmd = ubyteArrayOf(
0x12u, // flags
0xD5u, // READ I2C constant
0x04u, // manufacturer code
0b00001000u, // I2C address
0x00u // N-1 bytes to read
).toByteArray();
If more information is required, let me know.