How to correctly enable GPO interrupts on X-NUCLEO-NFC04A1?
Hello,
I'm facing problems while setting up the GPO interrupts from the evaluation board.
My application is to write some data using I2C to the tag, and then read it from a reader. TO avoid collisions (writing to EEPROM with I2C when there is NO RF operations in progress) I'm trying to setting up the tag to enable the RF_ACTIVITY interrupt, which, as I understood, should pull the GPO pin to low from the RF command (from reader) SOF to the RF response from the tag EOF, and then return to 1.
Now, I'm using a code which:
1) present I2C password which per default is set to 64 bit zeroes;
2) Write the command to the register using the function from the library
3) trying to read the GPO pin with its function, which should return a zero when there's an RF command. I suppose, here, that an RF command means even a read command from the reader. I'm using a X-NUCLEO-NFC03A1 with its demo code and its library, so the reader is always in read mode I think..
Here is my code:
ST25DV_PASSWD password; //it is a struct MsbPasswd and LsbPasswd both with 32 bits each, total 64 bits of password
password.MsbPasswd = 0;
password.LsbPasswd = 0;
Serial.print("DEBUG: I2C password (decimal value) is ");
Serial.print(password.MsbPasswd);
Serial.println(password.LsbPasswd);
Serial.print("DEBUG: Size of total password is ");
Serial.print(sizeof(password.MsbPasswd)+sizeof(password.LsbPasswd));
Serial.println(" bytes");
NFCTAG_StatusTypeDef NFC_tag_status = ST25DV_i2c_PresentI2CPassword(password);
if (NFC_tag_status == 0)
{
Serial.println("DEBUG: Command to present I2C password sent successfully!");
}
else
{
Serial.print("DEBUG: Error while sending command to present I2C password. Error code is: ");
Serial.println(NFC_tag_status);
}
// Now trying to call the function to set the GPO register correctly, to enable GPO pin trigger on RF_ACTIVITY. The correct value for pinGPOConf should be hex = 0x02
unsigned int pinGPOConf = 0x82;
NFC_tag_status = ST25DV_i2c_ConfigureGPO(pinGPOConf);
if (NFC_tag_status == 0)
{
Serial.println("DEBUG: Command to configure GPO Pin to RF_ACTIVITY sent successfully!");
}
else
{
Serial.print("DEBUG: Error while sending command to configure GPO Pin. Error code is: ");
Serial.println(NFC_tag_status);
}
void loop() {
// Try some functions to know the status of the GPO pin, which is already initialized by the X_Nucleo_Nfc04.begin() function at the beginning
int statusGPO = X_Nucleo_Nfc04.ST25DV_GPO_ReadPin();
if (statusGPO == 0) Serial.println("GPO set to zero!");
}NFC_tag_status returns always zero, so both the command to present I2C password and to configure the GPO register is OK, in fact with the ST25 Android app I can see the correct value I send to it using this code.
The problem is, in the loop function, the GPO pin is always read to one, even if I present the tag to the reader and it's read from it. Strange thing though, a friend of mine tried with an oscilloscope to connect to the GPO pin (which should be number 12 digital using the Arduino pin configuration, and from there the pin seems to be always at zero!
Also, the pinGPOConf, which is the value to configure the GPO register, I tried with both 0x02 (which sets the b1 of the GPO register to 1 and the rest of the bits at zero, b1 should be the one referred to the RF_ACTIVITY event), and also with 0x82, which is b7=1 and b1=1, where b7 is the GPO_Enable bit of the GPO register, as per the datasheet. Both of the configurations give the same result, as explained.
So can anyone help me try to find the problem? Maybe I misunderstood something.
Thank you in advance!
