NTAG I2C Pass-through with CLRC663

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

NTAG I2C Pass-through with CLRC663

跳至解决方案
643 次查看
Sean-Resolute
Contributor II

I am trying to test passthrough mode using NTAG-I2C+ dev kit for Arduino (OM23221ARD) to a CLRC663 reader running the SW297859 SDK, but have been unable to get any data written from the CLRC663 to the NTAG's SRAM buffer in passthrough. I've run the NfcrdlibEx9_NTagI2C example in SW297859 and this confirms that pass through is enabled on the NTAG. I've tried updating this block (see attached) to perform an ISO14443 exchange with the NTAG but the SRAM_I2C_READY of the NS_REG never gets set and if I dump the SRAM I don't see anything written. On the CLRC663 side I get a 0x201 error which looks like a timeout on waiting for a response (which makes sense since I don't currently have the NTAG sending anything back until the SRAM_I2C_READY gets set).

Attached is the code change that I made. Can someone please point me the correct direction for performing an ISO14443 exchange with the NTAG? Or is it even possible to perform passthrough exchanges with the CLRC663 running SW297859 SDK since it doesn't support P2P?

标签 (1)
0 项奖励
回复
1 解答
333 次查看
jeremyrittenhouse
Contributor I

Hi Fabian,

Thanks for your help on this. We got bi-directional communication working with the fast-write commands using the CLRC663 and an Arduino connected to the NTAG.

Attached are the code snippets that might save someone else some time in the future.

Jeremy

在原帖中查看解决方案

10 回复数
624 次查看
Fabian_R
NXP TechSupport
NXP TechSupport

Hello, my name is Fabian, I've been assigned to support your case.

Thank you for your interest in our products

I'm not sure if you have already checked AN11579 is explains the respective configurations and some Block communications schemes for data transfer depending on the requirements of your project. At this point, it is difficult to detect what is wrong with your setup. Please help us by trying to follow the mentioned schemes and let us know if you are still having issues.

 Please keep in mind that is very important to configure FD_ON and FD_OFF and get it's status while in session to correctly access the IC through the interfaces.

Please let me know if this information is helpful.

Best Regards,
Fabian
0 项奖励
回复
621 次查看
Sean-Resolute
Contributor II
Yes, I have looked at AN11579 and can get pass through working between the demo phone app and NTAG but not when using the CLRC663 as the Reader. It would be very helpful if you could tell if the CLRC663 is capable of pass through communications with NTAG I2C Plus to begin with?
0 项奖励
回复
587 次查看
Fabian_R
NXP TechSupport
NXP TechSupport

Hello sir,

Yes the CLRC663 does support Ntag I2C passthrough. The issue is that the example from the NFC Reader Library is only, reading specific pages of the NTAG I2C. Once the passthrough is enabled in the NTAGI2C, the CLRC663 needs to read directly to sector 0, page address 0xF0. As mentioned in section 11.3.1 the use of Fast Read commands are recommended.

Please keep in mind that both interfaces cannot be accessed at the same time and the status registers need to be implemented in your application using NS_REG.

Also, keep in mind that in order to access SRAM is required to power on the device via VCC

Unfortunately, we don't have a specific implementation for this in the Library examples.

If you could please share your application output and/or implementation. We may be able to provide further help.

Best Regards,
Fabian
0 项奖励
回复
571 次查看
Sean-Resolute
Contributor II
I have tried variations of this with no success. For reference on the NTAG is powered from VCC and I can see data get written to SRAM successfully when using the Android NTAG I2C app so I believe my issue is isolated to what I am doing on the CLRC663.

I am using the `./SW297859/Examples/NfcrdlibEx9_NTagI2C` example with the only change to the if block that deals with an NTAG in passthrough:
/* check for Pass-through mode */
if ((bDataBuffer[0] & PTHRU_ON_OFF))
{
LOG_DEBUG("Writing to NTAG");

uint8_t writeSRAMCmd[] = {0xA6, 0xF0, 0xFF}; // Fast right to Start address of the SRAM block
uint8_t dataToWrite[] = {0xDE, 0xAD, 0xBE, 0xEF}; // Example data

uint8_t sramWrite[sizeof(writeSRAMCmd) + sizeof(dataToWrite)];
memcpy(sramWrite, writeSRAMCmd, sizeof(writeSRAMCmd));
memcpy(sramWrite + sizeof(writeSRAMCmd), dataToWrite, sizeof(dataToWrite));

status = phpalI14443p4_Exchange(pHal, PH_EXCHANGE_DEFAULT, sramWrite, sizeof(sramWrite), NULL, 0);
CHECK_STATUS(status);

From the log statement I can see that we attempt to write something, but nothing shows up on the NTAG. I have tried manually appending a CRC as well as writing a full 64 bytes, but have been unable to get anything written. Could you give sample code of how I can write anything to the SRAM buffer?
0 项奖励
回复
437 次查看
Fabian_R
NXP TechSupport
NXP TechSupport

Hello sir,
Unfortunately, we don't have the specific implementation using phpalI14443p4_Exchange() since the implementation in the Ex9_NTagI2C example is using the MIFARE Ultralight API for performing T2T interfacing, we recommend please adopt this practice as well.
As recommended in the Datasheet, please use the FastRead command. The MfUl does have this function as: phalMful_FastRead()
I'm sure you already have checked SW3647 and SW3648.
But in SW3647, NTAG_I2C_Explorer_Demo is shown in CopyInterruptToSRAM() how we recommend copying the data into the SRAM for the CLRC663 to be able to read the passed values.

In SW3648, there is a file called Ntag_I2C_Demo which shows the implementation for reading into the SRAM. It is required to check if the SRAM is ready before starting to read the actual memory since it could be blocked from the NFC side.

I hope this information may be useful sir.

Best Regards,
Fabian
0 项奖励
回复
419 次查看
Sean-Resolute
Contributor II

I don't thing there is any issue with my configuration of the NTAG since I can see it working using the NXP Android reference app when I write to the NTAG then read back over I2C. I believe there is something I am missing on the CLRC663 side of things. I have tried phalMful_FastWrite() without success.

Could you provide reference code of using phalMful_FastWrite() that I could use as a starting point?

0 项奖励
回复
409 次查看
Fabian_R
NXP TechSupport
NXP TechSupport

Hello sir,

I believe this snippet from the Example may be helpful. Even if the implementation isn't for Pass-through.

Fabian_R_1-1718316525969.png

 

Unfortunately, as I mentioned we don't have an implementation at this moment as an example to share. My apologies for this.

If you could please try using the Mful_fastRead() and the sector select. Which in this case would be sector 0.

If you are having issues with the implementation please do not hesitate to share it with us to provide further support.

Best Regards,
Fabian
0 项奖励
回复
334 次查看
jeremyrittenhouse
Contributor I

Hi Fabian,

Thanks for your help on this. We got bi-directional communication working with the fast-write commands using the CLRC663 and an Arduino connected to the NTAG.

Attached are the code snippets that might save someone else some time in the future.

Jeremy

514 次查看
Fabian_R
NXP TechSupport
NXP TechSupport

Hello sir,
Thank you for sharing this code snippet.
In order to implement the RF -> I2C writing, it is required to first serve the correct direction, and the FD pin in NC_REG. Please share this register configuration to double-check if this is correct. Please keep in mind that this configuration has to be done through I2C.
The implementation of the start and end addresses looks good. I believe that the issue is with the register configurations, sir. Could you please check NC_REG values while in session?
It is recommended to please implement a CRC when writing to the SRAM directly.

Best Regards,
Fabian
0 项奖励
回复
461 次查看
Sean-Resolute
Contributor II
I can get passthrough working using the NXP sample app for Android (not for iOS) so this implies the NC_REG is set correctly on the NTAG side. What I can't get working is the CLRC663 writing to NTAG via passthrough.

void enablePassThroughRFToI2C() {
// From NFC SDK
// NTAG_SetTransferDir(ntagCoreStateHandle.ntagDriverHandle, RF_TO_I2C);
{
// ntag.writeRegister(Ntag::NC_REG, NTAG_NC_REG_MASK_PTHRU_ON_OFF, 0);
ntag.writeRegister(Ntag::NC_REG, NTAG_NC_REG_MASK_TRANSFER_DIR, RF_TO_I2C);
ntag.writeRegister(Ntag::NC_REG, NTAG_NC_REG_MASK_PTHRU_ON_OFF, 0x40);
}

For the CLRC663, as seen in the previous code snippet, I am prepending the APDU with:
uint8_t writeSRAMCmd[] = {0xA6, 0xF0, 0xFF}; // Fast write to Start address of the SRAM block

..but this is not working.

Could you provide sample code snippet for CLRC663 writing to the NTAG SRAM buffer?
0 项奖励
回复