Skip to main content
Visitor II
October 12, 2022
Solved

Automatic Antenna Tuning - ST25R3914

  • October 12, 2022
  • 9 replies
  • 5025 views

All,

Background

I am currently working on a project that uses the ST25R3914 nfc chip and would like to implement the Automatic Antenna Tuning (AAT) feature. After looking at the data sheet, it states that chip can perform antenna tuning automatically by sending it the direct command Calibrate Antenna. Great. I then looked through the RFAL library to see if there was an API function I could call that would execute this command, and I found rfalCalibrate.

This makes it easier to implement because I can now call the function mentioned above and the antenna will be tuned, but I had a few questions:

  1. When should I call this function? Should it be done after every tag that is detected?
  2. How often should it be called?
  3. Is there a configuration variable/register that needs to be set to get this feature to work?

Your expertise is greatly appreciated here.

Thank you in advance!

Adan

    This topic has been closed for replies.
    Best answer by Ulysses HERNIOSUS

    Hi,

    I would rather look at what the chip internal phase and amp measurement are revealing. I think 16 deg would be outside of the range of the chip internal measurements.

    Please refer to the section in the DS about "Measure Phase":

    0693W00000UoV2XQAV.png 

    Best Regards, Ulysses

    9 replies

    Technical Moderator
    October 13, 2022

    Hi Adan,

    please have also a look at AN4974: Antenna matching for ST25R3911B/ST25R391x devices

    For the antenna tuning you there is one register to set the target phase (our driver let's this default to 90deg) and then this is about it.

    Concerning how often you want it to call, you need to ask yourself what you want to achieve with it:

    1. Compensate potential temperature instability of the matching
    2. Compensate changing environment
    3. Compensate part-to-part variations of matching components, etc.
    4. ....

    IMO after every tag will not make sense. You will need to ask yourself what you want to achieve as above, devise procedures for your reader and test this if it achieves what you want.

    Best Regards, Ulysses

    APant.2Author
    Visitor II
    October 13, 2022

    Ulysses,

    Is the default 90deg phase a good starting point? Sorry, I don't have much experience with tuning antennas and also, my electrical background isn't up to par either ha.

    I will also figure out what exactly needs to done with the antenna tuning with my team and call that function accordingly.

    I was also wondering, how do I go about testing the calibrate function? Can I bring a metal object close to the antenna to cause some sort of distortion in the signal and then call the function?

    Thanks,

    Adan

    APant.2Author
    Visitor II
    October 13, 2022

    Another question I had was, how does the AAT affect low-power card detect?

    Thanks,

    Adan

    APant.2Author
    Visitor II
    October 17, 2022

    Ulysses,

    I have been calling the calibration routine in my code, for testing purposes, but I am running into an issue. The function returns a success, but the tri_err bit on the Antenna Calibration Display Register is set. This means, per the datasheet, that there was a calibration error. This confuses me since I get a ERR_NONE from the routine. Is there something I am not setting?

    Also, does the AAT affect low-power card detect?

    Thanks,

    Adan

    Technical Moderator
    October 17, 2022

    Hi Adan,

    ERR_NONE: Command was executed correctly from SPI perspective, interrupt did come, etc.

    tri_err can happen if you heavily detuned the antenna such that the phase set inside Antenna calibration target register cannot be reached anymore as this would be the starting point for the search.

    I think I answered your question on AAT vs low-power card detect before: "if amplitude is higher you can expect more range."

    Best Regards, Ulysses

    APant.2Author
    Visitor II
    October 17, 2022

    Ulysses,

    Interesting, I will take a look at the signal with a scope and see if I can figure out what I am doing wrong.

    Ahh okay, I see what you're saying. So if I call the calibrate function while it's in low-power mode, the system will remain in that state, but the distance I can detect a tag might increase. Makes sense.

    Thanks,

    Adan

    Technical Moderator
    October 18, 2022

    Hi Adan,

    About tri_err: If you detune too much the trim caps may not be sufficient to bring back the system close to the target phase. There is nothing you can really do about it in SW. For better understanding it may be helpful for you to sweep through all 16 trim values and record resulting amplitude and phase. ST25R3911B-DISCO in the GUI let's you do so.

    If you call the calibrate function while performing wake-up /LPCD there is a good chance that you just immediately wake-up as a changed trim will cause a change in LC-tank (changed amplitude and phase) and the old reference value is too far off.

    I would recommend that you calibrate before going into wake-up mode.

    BR, Ulysses

    APant.2Author
    Visitor II
    October 20, 2022

    Ulysses,

    I hooked up an oscilloscope to my tx and rx lines, at the antenna end, and measured the phase difference between the two lines at startup. I did this because the hardware engineer working with me on this project tuned the antenna to work at 13.56 Mhz. The measured value was ~16 deg and frequency ~13.590Mhz. I want to set this phase as my target. I'm now curious to know, how do you map the degrees to the register value. To set the 90 degree phase, the register is set to 0b1000000. This is confusing and not sure how to map the 16 deg phase to bits. The datasheet also only points to the command table, but doesn't explain the bits.

    I will also implement your recommendation regarding AAT and LPCD.

    Thanks,

    Adan

    Technical Moderator
    October 21, 2022

    Hi,

    I would rather look at what the chip internal phase and amp measurement are revealing. I think 16 deg would be outside of the range of the chip internal measurements.

    Please refer to the section in the DS about "Measure Phase":

    0693W00000UoV2XQAV.png 

    Best Regards, Ulysses

    APant.2Author
    Visitor II
    October 21, 2022

    Ulysses,

    I measured the phase and amplitude, along with the calibration display register, right after initialization (since the system automatically performs a calibrate call) and this is what I got:

    • Phase - 130 or 88.8 deg.
    • Amplitude - 255
    • Calibration display - 224 (0b11100000)

    I then modified the program to not perform any card detection and instead periodically recalibrated the antenna. I remeasured the values listed above right after the calibrate call and got roughly the same values. Phase is was the only parameter that seemed to change between 130 and 128.

    I am going to attempt this again, but with the algorithm enabled. I'll reply with the results.

    Thanks,

    Adan

    APant.2Author
    Visitor II
    October 21, 2022

    It appears that when I add the algorithm, it causes the calibration to mess up. The values I got from the registers are:

    • Phase - 129 or 89.3 deg
    • Amplitude - 255
    • Calibration display - 248 (0b1111_1000)

    I then reset the system and checked the values right after initialization and got the same results as above.

    Maybe the way I am calling calibrate is incorrect? For testing purposes, this is what I've been doing

    0693W00000UoXlUQAV.pngWhere NFC_RunDetectionAlgorithm is the state machine shown in the example code provided by ST.

    Thanks,

    Adan

    Technical Moderator
    October 24, 2022

    Hi Adan,

    What is the value of your antenna target register. A value of 16 does not sound plausible and I would rather set it to 90 as this is also what is reported.

    Also amplitude of 255 hints incorrect voltage divider and RFI inputs overloaded/saturated (symbol VRFI_A). Please discuss with your hardware engineer.

    To better analyze you need to sweep through all 16 trim values (tre bits) and record measured amplitude and phase.

    Please ask yourself / your hardware engineer what you want to achieve with antenna calibration (see above).

    Best Regards, Ulysses

    APant.2Author
    Visitor II
    October 24, 2022

    Ulysses,

    I did not change the antenna target register, it was left at its default ( 90 deg ).

    I will discuss the potential hardware issues with the engineer and also record the data you suggest.

    We've already had the discussion on what we want to achieve with the active antenna tuning. Because we are placing it on a moving part, the antenna has been shown to get detuned (from previous designs). This is why calibrating the antenna would be necessary.

    Thanks,

    Adan

    APant.2Author
    Visitor II
    October 24, 2022

    I went through all 16 trim values as you recommended and it appears that no combination of tre bits gets the phase to exactly 90 deg. As mentioned before, the default 90 deg target was used.

    I have attached an excel document showing the results I obtained. I used two different boards and wrote down my results.

    After looking at the results, is it safe to assume that the reason why tri_err bit is being set is because during the calibration sequence, the chip was not able to get the 90 deg target?

    Also, to me, it appears that there are two paths forward in my situation:

    1. The hardware engineer changes the cap values to allow the system to achieve the 90 target (hardware fix), or ..
    2. In software I change the target phase to be, say 80, as an example.

    Would you agree? Oh and also fix the amplitude issue you mentioned in your previous post.

    Thanks,

    Adan

    Technical Moderator
    October 25, 2022

    Hi Adan,

    correct, chip could not get close enough to 90deg. Your approach sounds good.

    BR, Ulysses

    APant.2Author
    Visitor II
    October 25, 2022

    Ulysses,

    I assume the equation, deg = 30 + [ ( (255 - x) / 255 ) * 120 ], is used to determine what value to write to the target register? Where if you want a 70 deg phase shift, you solve for x. The value you get for x is then written to the register.

    Thanks,

    Adan

    Technical Moderator
    November 2, 2022

    correct.