cancel
Showing results for 
Search instead for 
Did you mean: 

STSW-ST25RFAL002 - card emulation mode stalled state

pagano.paganino
Associate III

Hello,

using STSW-ST25RFAL002 to version 0x020200U (RFAL Current Version: v2.2.0) I encountered a problem in card emulation mode, practically the state machine remaine blocked on the RFAL_NFC_STATE_LISTEN_ACTIVATION state indefinitely rfal_nfc.c: 518 the rfalNfcListentivation() function always return ERR_BUSY.

This happened to me with several Android smartphones (with iPhone 2020 se no problem).

I solved it by adding this patch:

--- a/STSW-ST25RFAL002/source/rfal_nfc.c
+++ b/STSW-ST25RFAL002/source/rfal_nfc.c
@@ -516,6 +516,13 @@ void rfalNfcWorker( void )
 
         /*******************************************************************************/
         case RFAL_NFC_STATE_LISTEN_ACTIVATION:
+        if( platformTimerIsExpired( gNfcDev.discTmr ) )                           /* Check if the total duration has been reached */
+        {
+            rfalListenStop();
+            gNfcDev.state = RFAL_NFC_STATE_START_DISCOVERY;                       /* Restart the discovery loop */
+            rfalNfcNfcNotify( gNfcDev.state );                                    /* Notify caller             */
+            break;
+        }
         case RFAL_NFC_STATE_LISTEN_SLEEP:
 
             err = rfalNfcListenActivation();

If you have a better way of solving the problem I will be happy to apply it, I am not happy to have to bring patch to the third party library.

Thanks so much,

D.

14 REPLIES 14

Hi pagano.paganino,

could you share a logic analyzer trace of the issue?

On which platform is your source running? NUCLEO-L476 + X-NUCLEO-NFC06A1?

Regards, Ulysses

Hi Ulysses,

could you share a logic analyzer trace of the issue?

I ordered it, as soon as it arrives with pleasure

On which platform is your source running? NUCLEO-L476 + X-NUCLEO-NFC06A1?

NUCLEO-WB55 + X-NUCLEO-NFC06A1

Thanks and regards,

D.

Hi pagano.paganino,

I think I have all the hardware available - including iPhone SE 2020. If you provide a binary/hex (which includes the logging), I could give it a try.

Regards, Ulysses

Hi Ulysses,

attached the firmware for the nucleo-wb55 + x-nucleo-nfc06a1.

after finishing the flashing procedure:

  • Connect jumper JP1 on USB_MCU
  • Connect USB_USR
  • Connect to the nucleo board with a Terminal serial COM emulation (Es. picocom -b 115200 /dev/tty.usbmodem2070387130361)

if everything goes well you can see:

MicroPython v1.15-2-g6e0f9b926-dirty on 2021-04-20; NUCLEO-WB55 with STM32WB55RGV6
Type "help()" for more information.
>>> 
NUCLEO-WB55
SPI(1, baudrate=8000000, polarity=0, phase=1, bits=8)
Pin(Pin.cpu.A4, mode=Pin.OUT, pull=Pin.PULL_UP)
Pin(Pin.cpu.C0, mode=Pin.IN)

At this point everything is ready, in the software I have included an emulation of uri ndef pointing to the site https://community.st.com

and enabled logging for:

rfalBitRate bitRate;
bool isDataRcvd;
rfalLmState lmSt = rfalListenGetState( &isDataRcvd, &bitRate );
err = rfalNfcListenActivation();
printf("la: %d lgs: %d isdr: %d br: %d\n", err, lmSt, isDataRcvd, bitRate);

Thanks for all, regards.

D.

Hi pagano.paganino,

in my exeriments the iPhone SE 2020 always opened the URI. However using Samsung Galaxy S21 I see an immediate hang.

SPI trace shows the interrupt is stopped to be handled at some point, afterwards IRQ is constant high and no more SPI traffic:

0693W00000AMBRvQAP.pngZoomed in a bit more to see the last frames:

0693W00000AMBS0QAP.pngI would suspect damaged locking of SPI (platform(Un)Protect...(). I would assume that it depends on timing - if interrupt comes while an SPI transfer is ongoing. That's maybe why it is happening with the iPhone at your side but not at mine.

Regards, Ulysses