Hi there,
I am currently trying to send the chip PN5180 to LPCD mode (auto calibration) from an active mode (card reader poll mode).
As MCU i am using a MK81 processor which send the instructions via SPI bus to the NFC chip. The IDE is MCUExpresso IDE v10.2.0_759 with the NXP library NxpNfcRdLib_5.7.0.
Until now I was no able to find any complete sample code to fulfill this task.
Now I will show you what I have done and the source code related to this matter.
1- The registers mentioned in the data sheet related to LPCD mode are already set. The values readed from chip, (to proof it), are shown now.
ADDR = 34 -> 0x01
ADDR = 36 -> 0xff
ADDR = 37 -> 0x05
ADDR = 38 -> 0x00
ADDR = 39 -> 0xf0
ADDR = 3A -> 0xf0
2- The source code, used to send the chip PN5180 to LPCD mode (auto calibration) from an active mode (card reader poll mode), is given now.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
phStatus_t Cl_SwitchMode_to_LPCD()
{
phhalHw_Pn5180_DataParams_t *cl_pDataParams;
phacDiscLoop_Sw_DataParams_t *cl_SW_pDataParams;
phStatus_t status = PH_ERR_SUCCESS; //BP_1
uint16_t cl_wakeupCounterInMs = 1000;
/* Set the generic pointers */
cl_pDataParams = phNfcLib_GetDataParams(PH_COMP_HAL);
cl_SW_pDataParams = phNfcLib_GetDataParams(PH_COMP_AC_DISCLOOP);
/* Read and print registers values from EEPROM */
CL_get_LPCD_EE_Values(cl_pDataParams); //BP_2
/* Enable LPCD Mode*/
status = phacDiscLoop_SetConfig(cl_SW_pDataParams, PHAC_DISCLOOP_CONFIG_ENABLE_LPCD, PH_ON);
if(PH_ERR_SUCCESS== status)
{
PRINTF("LPCD_Mode Enable \t-> \tOK\n"); //BP_3
}
/* Switch to LPCD Mode*/
status = phhalHw_Pn5180_Instr_SwitchModeLpcd(cl_pDataParams, cl_wakeupCounterInMs);
if(PH_ERR_SUCCESS== status)
{
PRINTF("Switch_Mode instruction \t-> \tOK\n"); //BP_4
}
return status;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Please, I am in a hurry so your help is very appreciate.
Many thanks in advance and have a nice day.
Hello,
Please see below for internal apps team response:
First I would suggest checking the LPCD functionality by NFCCockpit, this way you will get and could set all relevant parameters, guidelines you can find in AN11744 (chapter 4.9) and in Datasheet.
After that when you have a working LPCD functionality, you can use test results in the application, don't get me wrong - the same parameters can be defined through embedded application also.
Next step would be to open one of the provided application in the PSP (e.g., NfcrdlibEx1_BasicDiscoveryLoop) supporting LPCD.
This example implements LPCD feature in a combination of discovery loop.
Please check next segments in the code:
/* Configure LPCD */
if ((status & PH_ERR_MASK) == PHAC_DISCLOOP_LPCD_NO_TECH_DETECTED)
{
status = phApp_ConfigureLPCD();
CHECK_STATUS(status);
}
/* Bool to enable LPCD feature. */
status = phacDiscLoop_SetConfig(pDataParams, PHAC_DISCLOOP_CONFIG_ENABLE_LPCD, PH_ON);
CHECK_STATUS(status);
When LPCD is appropriately configured and enabled, the library will automatically handle LPCD.
as a result of the discoveryLoop run, you can get "PHAC_DISCLOOP_LPCD_NO_TECH_DETECTED", which tells you that PCD returned success (LPCD triggered), but no technologies were detected during technology detection stage.
check this code snipped
else if ((status & PH_ERR_MASK) == PHAC_DISCLOOP_LPCD_NO_TECH_DETECTED)
{
/* LPCD is succeed but no tag is detected. */
}
I hope this will help you to use LPCD in your application.
Best regards,
Ivan.