cancel
Showing results for 
Search instead for 
Did you mean: 

ST25DV16 GPO Interrupt

ZHANGHN
Associate II

Hello everyone,

I am trying to control the GPO interrupt of ST25DV16 using X-CUBE-NFC04. I know that I should change the GPO register. As I want to use GPO_RFWRITE and GPO_ENABLE so the register value should be 0xC0. But when I want to use function CUSTOM_NFCTAG_WriteRegister, it doesn't work. I guess another function, CUSTOM_NFCTAG_ConfigIT, can also control the GPO interruption, but it doesn't work as well(these functions never return NFCTAG_OK). I am sure that I can read UID successfully and I can receive GPO interrupt(at default setting) successfully. The following are some of my codes:

 

if(CUSTOM_NFCTAG_Init("ST25DV16")!=HAL_OK) {

Error_Handler();

}

else{

CUSTOM_GPO_Init();

if(CUSTOM_NFCTAG_WriteRegister("ST25DV16", 0xC0, 0x0000, 1) == NFCTAG_OK){

HAL_UART_Transmit(&huart2,"writereg Success", strlen("writereg Success"), 0xFFFF);

 

}

if(CUSTOM_NFCTAG_ConfigIT("ST25DV16", ST25DV_GPO_ENABLE_MASK | ST25DV_GPO_RFWRITE_MASK)==NFCTAG_OK){

HAL_UART_Transmit(&huart2,"IT Success", strlen("IT Success"), 0xFFFF);

}

}

1 ACCEPTED SOLUTION

Accepted Solutions
JL. Lebon
ST Employee

Hello, 

There are two ways to enable/disable interrupts.

One is to set the GPO configuration byte in the System memory.
The other one is to write into the GPO_CTRL_Dyn register.

In order to write the GPO configuration byte in system memory, you must first present the RF configuration password (password 0), or I2C password if accessed from I2C, as it is write protected. I think this may be your problem.

For the GPO_CTRL_Dyn register, it is read only from the RF interface. It can be written only from the I2C interface.

I don't know if the CUSTOM_NFCTAG_WriteRegister() is trying to write the GPO configuration byte or the GPO_CTRL_Dyn register, you have to check that.

Best regards.

View solution in original post

3 REPLIES 3
JL. Lebon
ST Employee

Hello, 

There are two ways to enable/disable interrupts.

One is to set the GPO configuration byte in the System memory.
The other one is to write into the GPO_CTRL_Dyn register.

In order to write the GPO configuration byte in system memory, you must first present the RF configuration password (password 0), or I2C password if accessed from I2C, as it is write protected. I think this may be your problem.

For the GPO_CTRL_Dyn register, it is read only from the RF interface. It can be written only from the I2C interface.

I don't know if the CUSTOM_NFCTAG_WriteRegister() is trying to write the GPO configuration byte or the GPO_CTRL_Dyn register, you have to check that.

Best regards.

Thanks for your reply and I followed your advice. What's funny is that, after presenting the password(0), I can control GPO interrupt using the function CUSTOM_NFCTAG_ConfigIT. However, I still can not use the function CUSTOM_NFCTAG_WriteRegister to control the GPO register. If l use this function, it can return NFCTAG_OK but I will no longer receive any GPO interrupt. The following are some of my codes:

 

CUSTOM_GPO_Init();

if(CUSTOM_NFCTAG_PresentI2CPassword("ST25DV16", password )==NFCTAG_OK){

HAL_UART_Transmit(&huart2,"Present PW Success", strlen("Present PW Success"), 0xFFFF);

}

if(CUSTOM_NFCTAG_WriteRegister("ST25DV16", 0xCO, 0x0000, 1) == NFCTAG_OK){

HAL_UART_Transmit(&huart2,"writereg Success", strlen("writereg Success"), 0xFFFF);

}

Sorry, I found out that it was my own mistake. The second parameter of the function CUSTOM_NFCTAG_WriteRegister is a pointer instead of a value, so I can not directly put 0xC0 into the function. It's working now. Thanks for your reply.