NXPReaderLib 05.22.01 Lockup on Activating Activated Tag

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NXPReaderLib 05.22.01 Lockup on Activating Activated Tag

1,325 Views
eljeffo
Contributor III

When using CLRC663 NXPReaderLib 05.22.01 with FreeRTOS, after the Discovery Loop activates a Mifare Plus S/X Card, if then calling "phpalI14443p3a_ActivateCard(...)" on the already activated tag, the reader library will lock up.

The location of the lockup is at:

phOsal_Freertos.c

phStatus_t phOsal_EventPend(volatile phOsal_Event_t * eventHandle, phOsal_EventOpt_t options, phOsal_Ticks_t ticksToWait, phOsal_EventBits_t FlagsToWait, phOsal_EventBits_t *pCurrFlags) {

   ...

    CurrentFlags = xEventGroupWaitBits(*eventHandle, FlagsToWait,

        (options & E_OS_EVENT_OPT_PEND_CLEAR_ON_EXIT) >> E_OS_EVENT_OPT_POS_PEND_CLEAR_ON_EXIT,

        (options & E_OS_EVENT_OPT_PEND_SET_ALL) >> E_OS_EVENT_OPT_POS_PEND_SET_ALL,

        ticksToWait);  // BLOCKS Forever

Since xEventGroupWaitBits is called with ticksToWait = 0xFFFF  it will pretty much hang.

To hack this to bits (and to show one bad way of preventing the hang) you can modify:

"NxpNfcRdLib/comps/phhalHw/src/Rc663/phhalHw_Rc663.c" 

phStatus_t phhalHw_Rc663_Exchange....

        if(pDataParams->bCheckEmdErr != PH_ON || 1 ) // EVIL HACK TO IGNORE EMD Flag

        {         

           // Force this block to run to avoid BLOCK/LOCKUP                                     

            ...   

        }                                       

        else                                 

        {                                

            /* EMD Suppression is requested, Special Handling required */

            dwSaveReg = 0x00;                   

                                      

            /* Set wait IRQs  this required below */

            bIrq0WaitFor = PHHAL_HW_RC663_BIT_RXIRQ | PHHAL_HW_RC663_BIT_HIALERTIRQ | PHHAL_HW_RC663_BIT_IDLEIRQ | PHHAL_HW_RC663_BIT_EMDIRQ;

            bIrq1WaitFor = PHHAL_HW_RC663_BIT_TIMER1IRQ;

                                              

                                              

//printf("phhalHw_Rc663_CheckForEmdError(pDataParams, bIrq0WaitFor, bIrq1WaitFor, &dwMultiReg, &dwSaveReg);\n");

            status = phhalHw_Rc663_CheckForEmdError(pDataParams, bIrq0WaitFor, bIrq1WaitFor, &dwMultiReg, &dwSaveReg); // <-- this call will BLOCK/LOCKUP

                                      

            /* Parse Irq0 and Irq1 data */ 

            bIrq0Reg = (uint8_t)dwMultiReg;

            bIrq1Reg = (uint8_t)(dwMultiReg >> 8U);

        }

                    

Not sure if the intent is to actually lock up/block forever, or if it's a "don't do that" kinda bug, or if it truly is a bug.

Any comment?

 

Labels (1)
0 Kudos
4 Replies

1,173 Views
AlexanderB
NXP Employee
NXP Employee

Hi,

thank you very much for reporting this issue. That is not a wanted behaviour. A lock-up should never occur. 

Do you know what the FWT of the external tag is? The maximum can be 4,9 seconds. Maybe it is waiting for the FWT to be elapsed, did you check if it gives any event after roughly 5 seconds? 

Even though calling activate card on a activated card should be avoided because it is a state-machine mismatch. 

Best regards,

Alexander

0 Kudos

1,173 Views
eljeffo
Contributor III

Hold on a second... let me learn what FWT means. :smileysilly:  In any case I don't remember it ever unblocking and I'm sure it took me more than 5 seconds while debugging.

0 Kudos

1,173 Views
AlexanderB
NXP Employee
NXP Employee

Hi,

FWT means frame waiting time. This is the time the PCD (reader) is waiting for an response of the PICC (tag) before it is considered an erroneous situation. If the FWT is elapsed, depending on the protocol, the reader library will either try to do error recovery (retry to send, deactivate, etc...) or report a timeout.

But that would mean that after 5 seconds everything is unblocked and returned to normal operation. If this is not the case, it most likely is not that simple and smells like a real issue. 

Can you give me a system overview? What connections (UART, SPI, I2C...), what host micro-controller, what tags are used to test this, etc... 

Best regards,

Alexander

0 Kudos

1,173 Views
eljeffo
Contributor III

Hold on a second, I'm trying to revive the code that had the lockup (before I hacked a bunch of code in the readerlib) so that it would stop locking up.  Seems I don't have a commit in the proper state, so trying to figure out what it was so I have a "stable lockup state" to work with you in.

Thanks!

0 Kudos