2020-07-27 07:13 AM
Hello, I'm trying to write a program which will detect the tag. I follow the demo example NFC05 and use a function from rfal_nfcv.h file.
I detect a Tag sucessfully. But the problem is when I want to use Collision avoidance "rfalNfcvPollerCollisionResolution()". In the codeat the picture above, the program never go into the if statement and the function for anticollision is not executed.
Because of that I deleted the if statement and keep only the code inside. I get "HardFault_Handler" error.
I check the code step by step. The tag is detected, then anticollision function is executed, also the for statement at the end. Then program start againg (next cycle in while loop). When the program came to the Anticollision funtion, It gave me the error.
Here is the picture after first cycle:
Here is the picture in the second cycle, just before Error (next step I get error):
Do you have any idea what's wrong here. I was following the example program and check it, everything is almost the same.
Thank you for any advice.
all the best,
Domen
Solved! Go to Solution.
2020-08-04 05:39 AM
Hi!
I change it like this: wrData[DEMO_NFCV_BLOCK_LEN] = { naboji, 0, 0, 0 };
I don't know how, but now It's working.
Also thanks for the "note" you wrote... I try a few options and I figured out that no matter which type is, It's written into a Tag, but in Hexa format.
Brian I would like to ask you a question about other thing... In "demo.c" I want to detect if a Tag is present near reader or not (If the tag is present I want to use some functions if not I want to use some other functions).
Could you recommended me which variable use it (which variable changing the state if the Tag is present or not-so I can use it with if/while statement) or the easiest way to do it.
Best, Domen
2020-08-04 05:50 AM
Hi,
"I change it like this: wrData[DEMO_NFCV_BLOCK_LEN] = { naboji, 0, 0, 0 };" ==> when changing the value of naboji, the content of wrData will not be modified (i.e. the first byte will contain the initial value of naboji)...
For your second point, you can use the tag detect mode (aka wake up). When pressing the user button, you toggle the wake up mode. In this mode, once a tag is present in the field, the demoNotif() callback is called
Rgds
BT
2020-08-05 11:08 PM
Thank you for the idea with wake-up mode. The problem is if the tag is static (not moving) the reader don't read/write. If you take the tag away very fast, the reader don't have enough time to detect again and read/write data into a tag.
I try with other idea, which is: when the tag is present, you also have ID of a tag. And I have an "If staement" where checking the length...if the length is greater than 0 (It's mean the Tag is present) then execute the command.
void strel( void )
{
static rfalNfcDevice *nfcDevice; // to get a variable
if(nfcDevice->nfcidLen != 0)
{
naboji--;
}
}
The problem is that the "nfcidLen" is zero all the time.
Best, Domen
2020-08-06 12:28 AM
Hi,
I am not sure to have understood what you would like to achieve.
Is it something like:
Rgds
BT
2020-08-06 01:48 AM
Thank you Brian, I did similar as you said. For the "Tag dicovered/Tag not discovered" I used new variable as a "flag".
I was also thinking to check if the new tag is Detected. For this I want to compare Tag ID number. Can you suggest me a best way to get "Tag ID" in the "demo.c" file.
Best regards,
Domen
2020-08-06 02:35 AM
Hi
simple; nfcvDev->InvRes.UID
Rgds
BT
2020-08-06 03:50 AM
Hi,
Thanks, Like I thought. I already use "uid" variable from "demoNfcv()" and print it to the terminal.
If I use it like this, I always get the same number: 536871639
static void demoNfcv( rfalNfcvListenDevice *nfcvDev )
{
...
uid = nfcvDev->InvRes.UID;
platformLog("UID of the Tag: %d\r\n", uid);
...
If I use it like this (*uid), I always get different numbers but these numbers are like: 161 or 166 or 43. I think this is not the right numbers.
static void demoNfcv( rfalNfcvListenDevice *nfcvDev )
{
...
uid = nfcvDev->InvRes.UID;
platformLog("UID of the Tag: %d\r\n", *uid);
...
If I check the Tag with ST25R3911B-DISCO board and software "STSW-ST25PC001", the UID of the Tag is: "E002230021B68EA6".
Do you have any idea about this issue?
All the best,
Domen
2020-08-06 04:38 AM
Hi,
uid is a pointer. A pointer is an address to a memory location. This memory location is likely always the same and only its content changes. So platformLog("UID of the Tag: %d\r\n", uid); displays the actual address where the UID is stored.... 536871639 = 0x200002D7 which is the memory location in SRAM of the UID byte array.
uid is pointer to the first byte of the UID. *uid is therefore the value of the first byte of the UID. So, platformLog("UID of the Tag: %d\r\n", *uid); display the decimal value of the first byte of the UID...
The UID is displayed in the demoCycle loop. As the bytes are transmitted over RF in a reverse order, we first copy the UID in a local array and reverse the byte order and then display it:
ST_MEMCPY( devUID, nfcDevice->nfcid, nfcDevice->nfcidLen ); /* Copy the UID into local var */
REVERSE_BYTES( devUID, RFAL_NFCV_UID_LEN ); /* Reverse the UID for display purposes */
platformLog("ISO15693/NFC-V card found. UID: %s\r\n", hex2Str(devUID, RFAL_NFCV_UID_LEN));
If you want to use to compare the current UID with the previous one
Rgds
BT
2020-08-07 01:25 AM
Hi,
thank you. obviously I deleted to much code and forget to some times check the original example :)
Is It possible to use this example/project to read/write also a Tags which are not from STM manufacturing.
(something like this: https://www.mave.si/rfid-in-nfc-mediji/nfc-nalepka-icode-sli-x-iso15693.html or https://www.mave.si/rfid-in-nfc-mediji/icode-sli-slix-rfid-in-nfc-kartice-iso15693.html) hope it is :)
Best rgds,
Domen
2020-08-07 01:38 AM
Hi,
you can use the code as long as the licence terms are respected. See X-CUBE-NFC5 webpage for the licence terms. In a nutshell, as long as the code is used within a ST25R3911B reader, you can use tags from any manufacturer.
Rgds
BT