2019-11-30 01:49 PM
My code is little modified Nucleo NFC Sample code. But instead of using WriteURI I want to read URI from Android phone. Every time NFC returns success but variable used with ReadURI function has always the same value as previous.
My snippet:
int main(void)
{
/* Reset of all peripherals, Initializes the Flash interface and the systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
// Init of the Nucleo Board led
BSP_LED_Init(LED2);
// Init of the M24SR expansion board
initLED();
MX_GPIO_Init();
sURI_Info uri;
while (TT4_Init() != SUCCESS);
TT4_ReadURI(&URI);
// Prepare URI NDEF message content
while (1)
{
}
}
Anybody knows how to solve this problem?
Solved! Go to Solution.
2019-12-04 01:59 AM
Hi @Bartosz Mróz ,
It seems that your reader application is not sending the Deselect command to the tag after writing it. So the RF session is not closed correctly. You can test it by cutting the RF (Use RF OFF command on reader App or remove reader from Tag antenna).
You can also use a function that kill the RF session on M24SR side, But you must take care that no RF commands are sent while performing this.
Regards.
2019-12-03 02:23 AM
Hi @Bartosz Mróz ,
On my side your code is working as expected.
Are you sure that you correctly change the NDEF on the tag with the Android App? You read the NDEF after reset, then you enter infinite loop, before watching the new content are you sure to have reset the Nucleo?
I'm using the code for the STM32L476 platform and the ST25 NFC Tap App on Android phone (https://www.st.com/content/st_com/en/products/embedded-software/st25-nfc-rfid-software/stsw-st25001.html).
Regards.
2019-12-03 10:14 AM
Thank you for your explaination.
Like you pointed, everything works fine when I write data to NDEF then read and then I made a Nucleo reset. But I want to achieve continious job - write data, read and handle data. Without any resets.
I did small experiment and add method which read NDEF file on each user button click.
uint16_t TT4_RetriveData(){
uint16_t status = ERROR;
uint8_t buff[NDEF_MAX_SIZE];
NDEF_ReadNDEF(buff);
sURI_Info source;
sURI_Info *pURI;
sRecordInfo *pRecordStruct;
pRecordStruct = &RecordStruct;
pURI = &source;
NDEF_IdentifyNDEF(pRecordStruct, buff);
NDEF_ReadURI(pRecordStruct, pURI);
status = SUCCESS;
return status;
}
Before I clicked button I write tag 3 times with 3 different URI:
After button click I expected that I will have third URI in my pURI variable but I had first URI.
Any ideas how to resolve that?
2019-12-04 01:59 AM
Hi @Bartosz Mróz ,
It seems that your reader application is not sending the Deselect command to the tag after writing it. So the RF session is not closed correctly. You can test it by cutting the RF (Use RF OFF command on reader App or remove reader from Tag antenna).
You can also use a function that kill the RF session on M24SR side, But you must take care that no RF commands are sent while performing this.
Regards.