cancel
Showing results for 
Search instead for 
Did you mean: 

Our problem is that the ST25R card emulation example works correctly for a while (with a smartphone on the antenna) and suddenly the ST25R3916 chip does not generate further interrupts.

ralf239955_stm1
Associate II

In the states RFAL_LM_STATE_POWER_OFF or in RFAL_LM_STATE_IDLE ( function rfalRunListenModeWorker File rfal_rfst25r3916 ) the flags ST25R3916_REG_OP_CONTROL_en_fd_auto_efd are reset during detetcting a smartphone.

These bits are set only during initalisation. but why are they reset during working? ? ?

A workaround works better but not sufficient, sometimes a smartphone is detected. The workaround sets the ST25R3916_REG_OP_CONTROL_en_fd_auto_efd bits in both states (see code below).

The hardware is the discovery antenna board with st2533916 and via spi connected to our µc STm32L151.

The hardware antenna works with discovery mainboard fine.

Additional we implement in depency of the field on , to switch from power off to idle and reverse. (seee below)

On the saleae.com you can download a software, to analyse the logic spi data attached.

Ther are two records wih detecting a smartphone. The first tooks a long time to get the smartphone. the sceond ist ok.

   switch( gRFAL.Lm.state )

    {

        /*******************************************************************************/

        case RFAL_LM_STATE_POWER_OFF:

            

            irqs = st25r3916GetInterrupt( (  ST25R3916_IRQ_MASK_EON ) );

            if( irqs == ST25R3916_IRQ_MASK_NONE )

            {

            

st25r3916ReadRegister( ST25R3916_REG_OP_CONTROL, &OP_control );

if(  ( (OP_control & ST25R3916_REG_OP_CONTROL_en_fd_auto_efd)==0) ) 

{

    wobinich = 0;

    OP_control = (ST25R3916_REG_OP_CONTROL_en|ST25R3916_REG_OP_CONTROL_rx_en|ST25R3916_REG_OP_CONTROL_en_fd_auto_efd);

st25r3916WriteRegister( ST25R3916_REG_OP_CONTROL, OP_control );

st25r3916ReadRegister( ST25R3916_REG_OP_CONTROL, &OP_control );

}

                if( rfalIsExtFieldOn() )

                {

                   if( pwr_of_cnt > 100 )

                   {

                      rfalListenSetState( RFAL_LM_STATE_IDLE );

                   }

                   pwr_of_cnt++;

                }

                else

                {

                    pwr_of_cnt=0;

                }

                

        

              break;  /* No interrupt to process */

            }

            

            if( (irqs & ST25R3916_IRQ_MASK_EON) != 0U )

            {

                rfalListenSetState( RFAL_LM_STATE_IDLE );

            }

            else

            {

                break;

            }

            /* fall through */

            

              

        /*******************************************************************************/

        case RFAL_LM_STATE_IDLE:   /*  PRQA S 2003 # MISRA 16.3 - Intentional fall through */

            irqs = st25r3916GetInterrupt( ( ST25R3916_IRQ_MASK_NFCT | ST25R3916_IRQ_MASK_WU_F | ST25R3916_IRQ_MASK_RXE | ST25R3916_IRQ_MASK_EOF | ST25R3916_IRQ_MASK_RXE_PTA ) );

// st25r3916ReadRegister( ST25R3916_REG_OP_CONTROL, &OP_control );

            if( irqs == ST25R3916_IRQ_MASK_NONE )

            {

if(  ( (OP_control & ST25R3916_REG_OP_CONTROL_en_fd_auto_efd)==0) )

{

    wobinich = 0;

//     OP_control |= ST25R3916_REG_OP_CONTROL_en_fd_auto_efd;

    OP_control = (ST25R3916_REG_OP_CONTROL_en|ST25R3916_REG_OP_CONTROL_rx_en|ST25R3916_REG_OP_CONTROL_en_fd_auto_efd);

    st25r3916WriteRegister( ST25R3916_REG_OP_CONTROL, OP_control );

    st25r3916ReadRegister( ST25R3916_REG_OP_CONTROL, &OP_control );

}

                if( !rfalIsExtFieldOn() )

                {

                   if( idle_cnt > 100 )

                   {

                      rfalListenSetState( RFAL_LM_STATE_POWER_OFF );

                   }

                   idle_cnt++;

                }

                else

                {

                    idle_cnt=0;

                }

                break;  /* No interrupt to process */

            }

            

            if( (irqs & ST25R3916_IRQ_MASK_NFCT) != 0U )

            {

1 ACCEPTED SOLUTION

Accepted Solutions
Ulysses HERNIOSUS
ST Employee

Hi,

the traces indicate a damaged implementation of platform(Un)ProtectST25RComm():

@19.32s: [42:00 5A:03 00:C8 00:48 00:00 00:00]. With 42 the software was trying to read operation control register. However it seems an interrupt was coming in and software issues a request to read interrupt status (5A), colliding with the ongoing one. The result is that this frame was reading registers 02-06 and not interrupt status. If this happens during a write then arbitrary data will be written.

0693W000006FmmCQAS.pngRegards, Ulysses

View solution in original post

3 REPLIES 3
Brian TIDAL
ST Employee

Hi @ralf239955_stm1​ 

can you confirm the issue is solved with correct platformProtectComm()?

Thanks

Rgds

BT

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Ulysses HERNIOSUS
ST Employee

Hi,

the traces indicate a damaged implementation of platform(Un)ProtectST25RComm():

@19.32s: [42:00 5A:03 00:C8 00:48 00:00 00:00]. With 42 the software was trying to read operation control register. However it seems an interrupt was coming in and software issues a request to read interrupt status (5A), colliding with the ongoing one. The result is that this frame was reading registers 02-06 and not interrupt status. If this happens during a write then arbitrary data will be written.

0693W000006FmmCQAS.pngRegards, Ulysses

ralf239955_stm1
Associate II

Hi.

The Problem is solved with the correct ProtectST25RComm implementation.

Thanks al lot