cancel
Showing results for 
Search instead for 
Did you mean: 

How to correctly enable GPO interrupts on X-NUCLEO-NFC04A1?

lcopparoni
Associate III

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!

1 ACCEPTED SOLUTION

Accepted Solutions
JL. Lebon
ST Employee

Hello,

The ST25DV-I2C NFC tag exists in two different version: the ST25DVxxK-JF and the ST25DVxxK-IE.

The -JF version is the 12 pins version and the -IE is the 8 pins version. The main difference is that the -JF 12 pins version has a GPO pin which is a CMOS push-pull version, whereas the -IE 8 pin version has a GPO pin which is an open-drain version.

Open-drain output must be pulled-up to VCC and is active LOW.

CMOS push-pull version is active HIGH and must be power with the VDCG pin (5V to 1.8V).

The X-NUCLEO-NFC04A1 is using the -JF 12 pins version of the ST25DV-I2C. So, the GPO output of the ST25DV-I2C is active HIGH in the X-NUCLEO-NFC04A1. When GPO is not active, the GPO pin is LOW on this board.

Also,

Now about configuring the GPO to have the RF_ACTIVITY interrupt working, you need to activate two bits in the GPO configuration byte:

  • RF_ACTIVITY_EN bit 1 must be set to 1 to enable RF_ACTIVITY interrupt
  • GPO_EN bit 7 must be set to 1 to enable GPO output pin.

So, the value 0x82 must be written into the GPO configuration static register, at I2C system address 0000h.

One more comment: RF_ACTIVITY is active from RF request EOF (not SOF) to RF response EOF.

In the way you capture the GPO pin value, you probably miss the moment when GPO is active (which is in the order of only a few ms). Most of the the time, GPO is not active as the reader is not constantly sending RF commands.

You can check with an oscilloscope by triggering on GPO pin rising edge if this is correctly working or not. You can also check that VDCG pin is correctly powered to at least 1.8V.

Best regards.

View solution in original post

2 REPLIES 2
JL. Lebon
ST Employee

Hello,

The ST25DV-I2C NFC tag exists in two different version: the ST25DVxxK-JF and the ST25DVxxK-IE.

The -JF version is the 12 pins version and the -IE is the 8 pins version. The main difference is that the -JF 12 pins version has a GPO pin which is a CMOS push-pull version, whereas the -IE 8 pin version has a GPO pin which is an open-drain version.

Open-drain output must be pulled-up to VCC and is active LOW.

CMOS push-pull version is active HIGH and must be power with the VDCG pin (5V to 1.8V).

The X-NUCLEO-NFC04A1 is using the -JF 12 pins version of the ST25DV-I2C. So, the GPO output of the ST25DV-I2C is active HIGH in the X-NUCLEO-NFC04A1. When GPO is not active, the GPO pin is LOW on this board.

Also,

Now about configuring the GPO to have the RF_ACTIVITY interrupt working, you need to activate two bits in the GPO configuration byte:

  • RF_ACTIVITY_EN bit 1 must be set to 1 to enable RF_ACTIVITY interrupt
  • GPO_EN bit 7 must be set to 1 to enable GPO output pin.

So, the value 0x82 must be written into the GPO configuration static register, at I2C system address 0000h.

One more comment: RF_ACTIVITY is active from RF request EOF (not SOF) to RF response EOF.

In the way you capture the GPO pin value, you probably miss the moment when GPO is active (which is in the order of only a few ms). Most of the the time, GPO is not active as the reader is not constantly sending RF commands.

You can check with an oscilloscope by triggering on GPO pin rising edge if this is correctly working or not. You can also check that VDCG pin is correctly powered to at least 1.8V.

Best regards.

Hi.

Thanks for the reply.

I solved the issue yesterday evening. What I was doing was correct, here in the code, the only wrong thing which was not working was the last function ST25DV_GPO_ReadPin(). This was always returning HIGH, don't know why. I tried reading the GPO pin directly from arduino with a digitalRead to the pin 12, and finally I was able to see 1 when there was a RF activity/reading and 0 otherwise.

Thanks anyway a lot for the answer!