Skip to main content
Visitor II
July 4, 2020
Solved

ST25R3911B : RFAL Library : st25r3911OscOn() giving Error=1 on Custom Board

  • July 4, 2020
  • 7 replies
  • 3458 views

Hi ,

We have done preliminary test on X-Nucleo-NFC05A1 and than made our custom board using the reference circuit provided.

We have followed the sequence for Card Detection:

Now the the function work as follows:

  • rfalInitialize() gives ERROR_NONE
  • st25r3911OscOn() which is giving the error =1(ERR_NOMEM).
  • rfalFieldOff() gives ERROR_NONE
  • rfalNfcvPollerInitialize() gives ERROR_NONE
  • rfalFieldOnAndStartGT() gives ERROR_NONE
  • rfalNfcvPollerCheckPresence() gives the error=4 (ERR_TIMEOUT)

So before and after this function st25r3911OscOn() , everything looks good , just we are not getting what causing the error in st25r3911OscOn().

We have connected the 27.12MHz Crystal.

Also we have noticed that frquency of 9MHz on CRO across the crystal, so it is Okay ?

Moreover need a review on Power Supply section of the schematic.

I am attaching the screenshot , and in this

we have kept R7 Open and +5V Not Connected.

So any guess what is causing the issue ?

    This topic has been closed for replies.
    Best answer by Travis Palmer

    Hello Vaibh_p,

    If components are missing in the matching circuit, you will most likely have problems detecting the tags. This can cause either a reduced detection range or no detection at all.

    It seems, that there is something wrong with your crystal. It should either resonate at 13.56MHz or 27.12MHz. The bit "osc" in the IO Configuration Register 1 has to be set accordingly. Can you maybe populate the crystal of the ST25R3911B-DISCO or NFC05A1?

    I just measured the XTI pin of the ST25R3911B-DISCO.

    0693W000001sDSjQAM.png

    BR Travis

    7 replies

    ST Employee
    July 6, 2020

    Hello,

    Looking at your power circuit it looks good.

    I assume R16 and R7 are not connected. Your MCU is connected (VDD_MCU) to "+3V3".

    0693W000001sB9fQAE.jpg

    The 9MHz at the crystal sounds very strange to me. At the time you enable the osc, a signal will be driven by the ST25R3911B on the XTO pin. This signal is causing the crystal to resonate. If you attach a scope you should see the following picture:

    Green channel: VDD

    Red channel: XTI

    0693W000001sDTSQA2.png

    around 874us (at my scope shot) the crystal is already resonating at 27.12MHz. The magnitude of the crystal signal should be around 0.7Vpp to 1Vpp at the end. Please ignore the shape past Marker X2 since it is related to the wake-up pulse and turning off the crystal.

    please let me know, if you are seeing the same signals on your board.

    BR Travis

    vaibh_pAuthor
    Visitor II
    July 6, 2020

    Hi Travis, Thanks for the reply.

    As mentioned in my query , we have not connected "+5V" in the circuit.

    Everything is powered with "+3.3V", so we have connected "R16 and R6" and "R7" was left open. The "+5V" is kept for future use and not connected as of now.

    Yes correct MCU is connected to to same "+3.3V".

    So do we need to provide "+5V" also ?

    I am attaching entire schematic for reference, please have a look on it and do suggest us.

    Also , will the problem in supply section cause the problem in oscillator frequency ?

    Thank you.

    ST Employee
    July 6, 2020

    Hello,

    VDD can be connected to +3V3 (same voltage as VDD_IO).

    As long as VDD_IO and VDD are powered there should be no problem at all.

    Can you confirm that the crystal is starting?

    BR Travis

    Technical Moderator
    July 6, 2020

    Hi Vaibhav,

    Which version of RFAL are you using? (See #define RFAL_VERSION in rfal_rf.h).

    In old version of RFAL, st25r3911OscOn does not return any error code. Since version 2.2.0, st25r3911OscOn returns a status but the return value cannot be ERR_NOMEM. Only 2 possible values:

    • ERR_NONE: No error
    • ERR_SYSTEM: Failure during Oscillator activation

    I believe st25r3911OscOn likely returns ERR_SYSTEM in your case: as suggested by Travis, the 27.12MHz cristal should be checked

    Rgds

    BT

    vaibh_pAuthor
    Visitor II
    July 6, 2020

    Thank you Brian for quick reply.

    The RFAL Version is v2.0.10  and it is defined as "#define RFAL_VERSION   (uint32_t)0x02000aU "

    Meanwhile I am checking out with things suggested by Travis for Crystal oscillations.

    Technical Moderator
    July 6, 2020

    Hi

    in RFAL v2.0.10, st25r3911OscOn  does not return any status (void st25r3911OscOn( void )).

    Here is an updated version of st25r3911OscOn that checks that the effective oscillator status (lines 21-25) and returns a status. This may help you during investigation.

    ReturnCode st25r3911OscOn( void )
    {
     /* Check if oscillator is already turned on and stable */
     /* Use ST25R3911_REG_OP_CONTROL_en instead of ST25R3911_REG_AUX_DISPLAY_osc_ok to be on the safe side */
     if( !st25r3911CheckReg( ST25R3911_REG_OP_CONTROL, ST25R3911_REG_OP_CONTROL_en, ST25R3911_REG_OP_CONTROL_en ) )
     {
     /* Clear any eventual previous oscillator IRQ */
     st25r3911GetInterrupt( ST25R3911_IRQ_MASK_OSC );
     
     /* enable oscillator frequency stable interrupt */
     st25r3911EnableInterrupts(ST25R3911_IRQ_MASK_OSC);
     
     /* enable oscillator and regulator output */
     st25r3911ModifyRegister(ST25R3911_REG_OP_CONTROL, 0x00, ST25R3911_REG_OP_CONTROL_en);
     
     /* wait for the oscillator interrupt */
     st25r3911WaitForInterruptsTimed(ST25R3911_IRQ_MASK_OSC, ST25R3911_OSC_STABLE_TIMEOUT);
     st25r3911DisableInterrupts(ST25R3911_IRQ_MASK_OSC);
     }
     
     /* Double check that OSC_OK signal is set */
     if( !st25r3911CheckReg( ST25R3911_REG_AUX_DISPLAY, ST25R3911_REG_AUX_DISPLAY_osc_ok, ST25R3911_REG_AUX_DISPLAY_osc_ok ) )
     {
     return ERR_SYSTEM;
     }
     
     return ERR_NONE;
    }

    Rgds

    BT

    vaibh_pAuthor
    Visitor II
    July 6, 2020

    Thanks Brian ,

    So if I am correct , I can directly add this lines [Line 21 to 25] in existing code rather than porting to latest version of RFAL Library.

    Technical Moderator
    July 6, 2020

    yes and make sure to modify the function prototype declaration in st25r3911.h.

    You can also modify st25r3911Initialize to replace

    st25r3911OscOn()

    by

     ret = st25r3911OscOn();
     if( ret != ERR_NONE )
     {
     return ret;
     }

    Rgds

    BT

    vaibh_pAuthor
    Visitor II
    July 6, 2020

    Hi Brian and Travis ,

    I have made changes as suggested by you guys. Thanks for that.

    Following are the observations:

    1. st25r3911OscOn() is returning ERR_NONE.
    2. rfalNfcvPollerCheckPresence() is now returning ERR_TIMEOUT i.e. Error No. 4
    3. We have connected "R6 and R16" and kept "R7" open , i.e. providing VDD and VDD_IO with 3.3V supply.
    4. One thing we have noticed that , we had misplaced the Capacitor in Antenna Circuit "680pF_50V" , so we have connected their parallel combination of "470pF+220pF" , so will it cause problem in detecting Tag ?
    5. The frequency across the crystal is still the same i.e. 9MHz , I have attached the picture of that.

    So I guess we are very close now in detection of tag , so please guys suggest something which are creating the problem.

    Thanks a lot for your help till now!!!

    ST Employee
    July 6, 2020

    Hello Vaibh_p,

    If components are missing in the matching circuit, you will most likely have problems detecting the tags. This can cause either a reduced detection range or no detection at all.

    It seems, that there is something wrong with your crystal. It should either resonate at 13.56MHz or 27.12MHz. The bit "osc" in the IO Configuration Register 1 has to be set accordingly. Can you maybe populate the crystal of the ST25R3911B-DISCO or NFC05A1?

    I just measured the XTI pin of the ST25R3911B-DISCO.

    0693W000001sDSjQAM.png

    BR Travis

    vaibh_pAuthor
    Visitor II
    July 7, 2020

    Hello Travis ,

    You are absolutely correct , the problem is due to crystal.

    Actually the entire Crystal lot we have ordered are damaged one , since we have checked with multiple crystals for appropriate frequency.

    Meanwhile we have managed to get another 27MHz crystal from old pcb and bingo , that worked and resonate at 27MHz and now the board is capable of detecting the tags.

    While we are working on detection range now , as for now for our antenna size is 5cm*4cm and the tag size is 3cm Circular , with this setup we are getting range of approx 3 to 3.5cm.

    So any links or threads related to increase the range ?

    One question , can we achieve the good range near about 10cm as it is ISO15693 Technology by keeping the reader antenna size small and tag antenna size large ?

    For your help till now, Thank you so much @Travis Palmer_O​  and @Brian TIDAL_O​  , we are really grateful for your help guys.

    ST Employee
    July 7, 2020

    ​Hello,

    Using the NFC05A1 (47 mm x 34 mm, four turns, 13.56 MHz inductive antenna etched on PCB and associated tuning circuit) the average read range  of ISO14443A tags is around 60 to 70mm and 110 to 120mm of ISO15693 tags.

    It always depends on tag antenna size, tag resonance frequency and power consumption of the tag.

    Since the NFC05A1 is designed to serve all technologies and bitrates (even VHBR) there is still some room for improvement.

    But it is a good starting point. How big the card antenna will be at the end mostly depends on the application.

    BR Travis

    vaibh_pAuthor
    Visitor II
    July 7, 2020

    Okay , Thank you Travis. We will look on the above points while designing tags.