A PTX1xxR or a PTX130W device (NFC device) has been connected via I2C to a custom MCU and SDK initialization fails. It is unclear if an incorrect implementation of the I2C HAL in the SDK causes the issue or if the I2C channel in general is not working, e.g. wrong wiring or I2C module configuration.
It is recommended to run a smoke-test to ensure that the I2C interface is working without actually using the SDK code itself. For that purpose following Python code examples can be either used directly, or re-implemented for the target system. Get yourself familiar with I2C first (refer to I²C - Wikipedia) before start interfacing to the NFC device using I2C.
Connect the NFC device to the host device. Following I2C transaction is recommended for testing basic I2C communication:
To execute that command a simple python script can be used (port it to the specific platform if the platform does not support Python 3):
#!/usr/bin/python # to run this script please install smbus2 via "pip install smbus2" from smbus2 import SMBus, i2c_msg channel = 1 # I2C channel 1 is connected to the GPIO pins address = 0x4F #address of the PTX as used on the PTX Evalboard 1v3 bus = SMBus(channel) write = i2c_msg.write(address, [0x30, 0xFF]) read = i2c_msg.read(address, 1) result = bus.i2c_rdwr(write, read) print (''.join('0x' + format(x, '02X') + ',' for x in list(read)))
The expected output when running this example is 0x21
,. Please note that this confirms basic I2C functionality but still implementation-dependent bugs (e.g. byte alignment for DMA transfers, maximum buffer size limitations) or even hardware-related issues (e.g. bad ground, capacitive behavior on data lines) can cause a I2C communication fail even if the basic I2C transaction shown in this example works. For correct operation of the NFC device also an interrupt signal is required, but usually validation of the reception of that signal can be done while implementing the SDK's HAL layer.