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;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- Do you see something out of the place or something missing?
- Do you have a procedure instructions step by step to achieve this task?
- Until now, I have found sample codes where the instruction "phhalHw_Pn5180_Instr_SwitchModeLpcd()" is not used, so that is why I am confuse, becouse in the data sheet they mention it as a crusial part of the process.
Please, I am in a hurry so your help is very appreciate.
Many thanks in advance and have a nice day.