Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding AttennaOff and get/set of AntennaGain #47

Merged
merged 1 commit into from
Nov 10, 2014

Conversation

mdxs
Copy link
Contributor

@mdxs mdxs commented Nov 10, 2014

Implementation for changing the MFRC522 Receiver Gain (RxGain) as discussed in #43. Allowing the Sketch to change the detection/interaction range (distance at which the PCD can interact with the PICCs).

Adding the following functions:

  • PCD_GetAntennaGain() - Get the current MFRC522 Receiver Gain (RxGain[2:0]) value.
  • PCD_SetAntennaGain() - Set the MFRC522 Receiver Gain (RxGain[2:0]) to given mask.
  • and also (just to complement the above and the already existing PCD_AntennaOn():
    • PCD_AntennaOff() - Turns the antenna off by disabling pins TX1 and TX2.

Where RxGain[2:0] is configured via the RFCfgReg register as described in 9.3.3.6 / table 98 of the datasheet at http://www.nxp.com/documents/data_sheet/MFRC522.pdf

To support the Sketch developers, a PCD_RxGain enum is added to define the allowed values for RxGain[2:0] (a 3 bit pattern within the RFCfgReg register). Note that 9.3.3.6 of the datasheet shows that the RFCfgReg register has some reserved bits as well.

@omersiar
Copy link
Contributor

Nicely done

miguelbalboa added a commit that referenced this pull request Nov 10, 2014
Adding AttennaOff and get/set of AntennaGain
@miguelbalboa miguelbalboa merged commit 92544ca into miguelbalboa:master Nov 10, 2014
@miguelbalboa
Copy link
Owner

Thank you

@Netoperz
Copy link

Netoperz commented Feb 6, 2016

Hello, stupid question... where can i find a proper example how to use / set the antenna gain in sketch code ?

@foobar76
Copy link

foobar76 commented Mar 11, 2017

@Netoperz I just looked in the suggested pdf Table 98

Serial.println(mfrc522.PCD_GetAntennaGain()); // gives me a 64 (00000010)
mfrc522.PCD_SetAntennaGain(112); // set to max (00001110)
Serial.println(mfrc522.PCD_GetAntennaGain()); //gives me the 112

Afterwards, I can see the demo card getting read from a significant bigger distance.

If anybody can tell me, why me NTAG216 implant is still not corresponding, your'e welcome :)

@martinius96
Copy link

@Netoperz I just looked in the suggested pdf Table 98

Serial.println(mfrc522.PCD_GetAntennaGain()); // gives me a 64 (00000010)
mfrc522.PCD_SetAntennaGain(112); // set to max (00001110)
Serial.println(mfrc522.PCD_GetAntennaGain()); //gives me the 112

Afterwards, I can see the demo card getting read from a significant bigger distance.

If anybody can tell me, why me NTAG216 implant is still not corresponding, your'e welcome :)

so, 112 is max value for gain? or 255 is max?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants