AnsweredAssumed Answered

Response to 2nd SELECT without RF off in HCE (PN5180)

Question asked by KK Leung on Oct 20, 2019
Latest reply on Dec 18, 2019 by Mark Vanophalvens

Hi,

 

I am implementing card emulation based on the HCE example in the NXP reader library. Since I am not working on any OS platform, multi-threading is not supported, so I have to port the code on my own and this should be alright since I just need to support the READBINARY command. I test my work with an old Android phone Nexus 5 but cannot get the NDEF message. The communication between Pn5180 and the Nexus5 is OK upon a point after Nexus 5 issue DESELECT and try to activate the card (PN5180) again, PN5180 doesn't response to the SELECT command anymore, until Nexus 5 timeout and reset the RF field. I attached the message capture here.

message capture shows SELECT timeout

The above pattern keep repeats.

The functions I called in my program is as below:

do
    {
        /* Turn OFF RF field if already on */
        phhalHw_FieldOff(...);
        phhalHw_Autocoll(...);

        if ((wStatus & PH_ERR_MASK) == PH_ERR_EXT_RF_ERROR)
        {
            /* Reset SLEEP_AF state (Respond to WUPA/REQA as field OFF is observed. */
            phhalHw_SetConfig(pHal, PHHAL_HW_CONFIG_MFHALTED, PH_OFF);
        }
        if ((wStatus & PH_ERR_MASK) == PH_ERR_SUCCESS)
        {
            phpalI14443p4mC_Activate(...);

            if ((wStatus & PH_ERR_MASK) == PH_ERR_SUCCESS)
            {
                wStatus = phceT4T_Activate(pT4t_Params);
                if ((wStatus & PH_ERR_MASK) == PH_ERR_SUCCESS_DESELECTED)
                {
                    /* Set SLEEP_AF state (Respond only to WupA ("52"), not to
                     * ReqA ("26")), so set MFHalted bit. After this setting is
                     * done "phhalHw_Autocoll" should be called immediately from
                     * Application so that HAL will know if there is any Field
                     * reset in "phhalHw_Autocoll" API and reset this setting. */
                    phhalHw_SetConfig(pHal, PHHAL_HW_CONFIG_MFHALTED,PH_ON);
                  }
            }
            phpalI14443p4mC_ResetProtocol(&pI14443mC_Params);
            phceT4T_Reset(pT4t_Params);
        }
        phOsal_EventClear(
            (&pT4t_Params)->T4TEventObj.EventHandle,
            E_OS_EVENT_OPT_NONE,
            (E_PH_OSAL_EVT_RXDATA_AVAILABLE | E_PH_OSAL_EVT_TXDATA_AVAILABLE |
             E_PH_OSAL_EVT_ABORT | E_PH_OSAL_EVT_ERROR | E_PH_OSAL_EVT_RTO_TIMEOUT),
            NULL);
    } while (!timeout);

It seems to me that after the card (PN5180) is DESELECT for the first time and call phhalHw_Autocoll() again to switch PN5180 into Autocoll mode, it will not response to SELECT from the reader anymore, until the reader reset (RF reset). Is there any register setting, command or EEPROM config to make PN5180 response to SELECT after DESELECT? I have tried comment out the MFHALTED config from the above code but no luck.

 

Thanks for the help.

Outcomes