cancel
Showing results for 
Search instead for 
Did you mean: 

ST25R3916 port ST25R_SELFTEST_TIMER error

enric.puigvert
Associate II

Hi,

I am trying to port the rfal library for an ST25R3916. I have defined all mandatory pins, ports and interfaces which RFAL requires in the help documentation.

I have read that  ST25R_SELFTEST and ST25R_SELFTEST_TIMER are a good way to find the issues with the integration of RFAL library to my project.

When I enable the above flags, I can see that the ST25R_SELFTEST is passed correctly without any error, but for ST25R_SELFTEST_TIMER it fails in st25r3916WaitForInterruptsTimed function:

 

 

 

/******************************************************************************
     * Check SW timer operation :
     *  - use the General Purpose timer to measure an amount of time
     *  - test whether an interrupt is seen when less time was given
     *  - test whether an interrupt is seen when sufficient time was given
     */
    
    st25r3916EnableInterrupts( ST25R3916_IRQ_MASK_GPE );
    st25r3916SetStartGPTimer( (uint16_t)ST25R3916_TEST_TMR_TOUT_8FC, ST25R3916_REG_TIMER_EMV_CONTROL_gptc_no_trigger);
    uint32_t err = st25r3916WaitForInterruptsTimed( ST25R3916_IRQ_MASK_GPE, (ST25R3916_TEST_TMR_TOUT - ST25R3916_TEST_TMR_TOUT_DELTA));
    if( err != 0U )
    {
        platformErrorHandleErr(err);
        return RFAL_ERR_SYSTEM;
    }

 

 

 

The error I can see is 0x00080000U (I think is ST25R3916_IRQ_MASK_WT, correct me if not). I can also tell you the error rfalInitialize() retrieves: 0x8U (RFAL_ERR_SYSTEM).

Could you kindly help me to solve this error? I can't figure it out for myself.

Thank you very much

Enric Puigvert

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ulysses HERNIOSUS
ST Employee

Hi Enric,

the timer selftest is assessing whether the timers inside ST25R and the ones you configure using platform.h correlate. In the shown snippet it is expected that st25r3916WaitForInterruptsTimed() does not get the interrupt from the ST25R in-time. I think your platformTimer*() macros are not working as expected in below code:

uint32_t st25r3916WaitForInterruptsTimed( uint32_t mask, uint16_t tmo )
{
    uint32_t tmrDelay;
    uint32_t status;

    tmrDelay = platformTimerCreate( tmo );

    /* Run until specific interrupt has happen or the timer has expired */
    do
    {
        status = (st25r3916interrupt.status & mask);
    } while( ( (!platformTimerIsExpired( tmrDelay )) || (tmo == 0U)) && (status == 0U) );

    platformTimerDestroy( tmrDelay );

    status = st25r3916interrupt.status & mask;

    platformProtectST25RIrqStatus();
    st25r3916interrupt.status &= ~status;
    platformUnprotectST25RIrqStatus();

    return status;
}

 

Best Regards, Ulysses

View solution in original post

2 REPLIES 2
Ulysses HERNIOSUS
ST Employee

Hi Enric,

the timer selftest is assessing whether the timers inside ST25R and the ones you configure using platform.h correlate. In the shown snippet it is expected that st25r3916WaitForInterruptsTimed() does not get the interrupt from the ST25R in-time. I think your platformTimer*() macros are not working as expected in below code:

uint32_t st25r3916WaitForInterruptsTimed( uint32_t mask, uint16_t tmo )
{
    uint32_t tmrDelay;
    uint32_t status;

    tmrDelay = platformTimerCreate( tmo );

    /* Run until specific interrupt has happen or the timer has expired */
    do
    {
        status = (st25r3916interrupt.status & mask);
    } while( ( (!platformTimerIsExpired( tmrDelay )) || (tmo == 0U)) && (status == 0U) );

    platformTimerDestroy( tmrDelay );

    status = st25r3916interrupt.status & mask;

    platformProtectST25RIrqStatus();
    st25r3916interrupt.status &= ~status;
    platformUnprotectST25RIrqStatus();

    return status;
}

 

Best Regards, Ulysses

enric.puigvert
Associate II

Hi, 

Sorry for the  late response.

The problem seem to be a debugging print which we had written (by mistake) in the timer callback. This retarded the interrupt handling and the RFAL check was unsuccessful.

Now the ST25R_SELFTEST and ST25R_SELFTEST_TIMER pass successfully.

Thank you for your response.