i am using clrc663 for card reader i implement lpcd mode there i am facing issue there lpcd calibration function i run i getting i and q value is 0x00 i am getting from antenna what is the issue how to i solve this
this function i am using
/* ------------------------------------------------------------------
* Run LPCD calibration once after power-up
* ------------------------------------------------------------------ */
phStatus_t LPCD_Calibrate(void)
{
phStatus_t status;
uint32_t refVal;
char dbg_buf[64];
// Ensure RF ON before calibration
phhalHw_FieldOn(pHal);
phhalHw_Wait(pHal, PHHAL_HW_TIME_MILLISECONDS, 5);
status = Calibrate_LPCD(LPCD_DEMO_MODE_DEFAULT, &refVal);
// Turn RF off after calibration
phhalHw_FieldOff(pHal);
if (status == PH_ERR_SUCCESS)
{
gLpcdValueI = (uint8_t)(refVal & 0xFF);
gLpcdValueQ = (uint8_t)((refVal >>
gLpcdCalibrated = 1;
sprintf(dbg_buf, "LPCD Calibration OK (I=0x%02X, Q=0x%02X)\r\n",
gLpcdValueI, gLpcdValueQ);
DEBUG_UART2((unsigned char*)dbg_buf, strlen(dbg_buf));
}
else
{
DEBUG_UART2((unsigned char*)"LPCD Calibration FAILED\r\n", 28);
}
return status;
}
Hello sir,
In order to calibrate the CLRC663 for LPCD, we highly recommend to please use NFC Cockpit.
This is a GUI tool that allows the user to graphically fine-tune the antenna along with LPCD calibration (Section 4.5) . We encourage you to please use this method since the calibration has to be done depending of your own design. There is no manual to do this procedure in a step-by-step manner.
NFC Cockpit allows the user to calibrate, while the reader is unloaded and then, loaded in real time.
Please explore the possibility of checking the 4th video for the following antenna design video series: NFC Antenna Design | NXP Semiconductors
i am using custom pcb clrc663 with stm32 hardware antenna tunning is correct only in software i used libraries nfcrdlibEx6_rc663_LPCD_Demo.c for calibration demo code there available that only i used but i getting 0x00 for i and q values then i used error register for identify what error i getting in
printf debug i getting
=== EEPROM / LPCD Check Start ===
VERSION(0x7F)=0x1A
ERROR(before)=0x00
ERROR(after LOADREG)=0x80
>>> EEPROM error (0x80) still present. LPCD may not calibrate correctly!
=== EEPROM / LPCD Check Done ===
// this is the code
phStatus_t Rc663_EepromInitAndCalibrateLPCD(
phhalHw_Rc663_DataParams_t *pHal,
uint32_t *pdwLPCDRefValue)
{
phStatus_t status;
uint8_t bVersion, bIrq1, bErr;
uint8_t bValueI = 0, bValueQ = 0;
char dbg[64];
uint8_t eepromVal;
uint8_t addr;
sprintf(dbg, "\r\n=== EEPROM + LPCD Init ===\r\n");
DEBUG_UART2((uint8_t*)dbg, strlen(dbg));
/* 1. Read chip version */
status = phhalHw_Rc663_ReadRegister(pHal, PHHAL_HW_RC663_REG_VERSION, &bVersion);
CHECK_STATUS(status);
sprintf(dbg, "VERSION(0x7F)=0x%02X\r\n", bVersion);
DEBUG_UART2((uint8_t*)dbg, strlen(dbg));
/* 2. Clear any existing errors */
phhalHw_Rc663_ReadRegister(pHal, PHHAL_HW_RC663_REG_ERROR, &bErr);
sprintf(dbg, "ERROR(before)=0x%02X\r\n", bErr);
DEBUG_UART2((uint8_t*)dbg, strlen(dbg));
/* 3. Force LOADREG from EEPROM into registers */
status = phhalHw_Rc663_WriteRegister(pHal,
PHHAL_HW_RC663_REG_COMMAND,
PHHAL_HW_RC663_CMD_LOADREG);
CHECK_STATUS(status);
/* Small delay for EEPROM load */
phhalHw_Wait(pHal, PHHAL_HW_TIME_MILLISECONDS, 5);
/* 4. Check error register again */
phhalHw_Rc663_ReadRegister(pHal, PHHAL_HW_RC663_REG_ERROR, &bErr);
sprintf(dbg, "ERROR(after LOADREG)=0x%02X\r\n", bErr);
DEBUG_UART2((uint8_t*)dbg, strlen(dbg));
if (bErr & PHHAL_HW_RC663_BIT_EE_ERR)
{
sprintf(dbg, ">>> EEPROM error (0x%02X) detected!\r\n", bErr);
DEBUG_UART2((uint8_t*)dbg, strlen(dbg));
/* --- EEPROM Dump (first 16 bytes for debug) --- */
for (addr = 0; addr < 0x10; addr++)
{
phhalHw_Rc663_Cmd_ReadE2(pHal, addr, 1, &eepromVal);
sprintf(dbg, "EEPROM[0x%02X] = 0x%02X\r\n", addr, eepromVal);
DEBUG_UART2((uint8_t*)dbg, strlen(dbg));
}
/* --- Bypass EEPROM and continue with manual init --- */
sprintf(dbg, "Bypassing EEPROM, using manual RF settings...\r\n");
DEBUG_UART2((uint8_t*)dbg, strlen(dbg));
phhalHw_Rc663_WriteRegister(pHal, PHHAL_HW_RC663_REG_DRVMODE, 0x89);
phhalHw_Rc663_WriteRegister(pHal, PHHAL_HW_RC663_REG_TXAMP, 0x1F);
phhalHw_Rc663_WriteRegister(pHal, PHHAL_HW_RC663_REG_DRVCON, 0x18);
}
else
{
sprintf(dbg, "EEPROM LOADREG OK.\r\n");
DEBUG_UART2((uint8_t*)dbg, strlen(dbg));
}
/* 5. Clear IRQ flags */
phhalHw_Rc663_WriteRegister(pHal, PHHAL_HW_RC663_REG_IRQ0, 0x7F);
phhalHw_Rc663_WriteRegister(pHal, PHHAL_HW_RC663_REG_IRQ1, 0x7F);
/* 6. Enable calibration mode */
phhalHw_Rc663_WriteRegister(pHal, PHHAL_HW_RC663_REG_LPCD_OPTIONS, 0x02);
/* 7. Start LPCD_CALIBRATE (0x37 is the hidden calibrate command) */
phhalHw_Rc663_WriteRegister(pHal, PHHAL_HW_RC663_REG_COMMAND, 0x37);
/* 8. Wait for LPCDIRQ */
do {
phhalHw_Rc663_ReadRegister(pHal, PHHAL_HW_RC663_REG_IRQ1, &bIrq1);
} while (!(bIrq1 & PHHAL_HW_RC663_BIT_LPCDIRQ));
/* 9. Read I/Q results */
phhalHw_Rc663_ReadRegister(pHal, PHHAL_HW_RC663_REG_LPCD_RESULT_I, &bValueI);
phhalHw_Rc663_ReadRegister(pHal, PHHAL_HW_RC663_REG_LPCD_RESULT_Q, &bValueQ);
/* 10. Store */
*pdwLPCDRefValue = (uint32_t)bValueI | ((uint32_t)bValueQ << 8);
sprintf(dbg, "[LPCD] Calibration done: I=0x%02X Q=0x%02X Ref=0x%08X\r\n",
bValueI, bValueQ, *pdwLPCDRefValue);
DEBUG_UART2((uint8_t*)dbg, strlen(dbg));
return PH_ERR_SUCCESS;
}
Sorry, but the support for custom boards is very limited.
For me to provide any specifics would need to have your hardware since there are a lot of differences between the configurations that work for the antenna setup from the Evaluation kit and yours.
Still, do you mind please sharing the Smith Chart of your antenna and schematic, this could be a great starting point for us to provide a good recommendation.
As mentioned in my last post, there are some steps we recommend to follow from the beginning. One of these are the use of our EVK with your new antenna and a new matching circuit. All of this is shown across a lot of our documentation. Please take a look at NFC Antenna Design | NXP Semiconductors video 2.
The I and Q values should show a different value than 0x0 after RF On command is sent.
Hello sir,
Thank you very much for sharing your Schematics with us. Still, I have to ask for the Smith Chart of your antenna. We do have an Application Note that shows the steps to perform these measurements using a cheap Nano-VNA.