2020-07-27 7: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-07-29 4:14 AM
Hi,
the easiest way is to use the demo.c as a starting point. This does the basic technology detection activity, anti collision activity etc.
Once a Type V tag has been discovered, the demoCycle calls demovNfcv(). This function demonstrates how to do a Read Single Block (it reads the block 0 and displays its content on the serial log). It demonstrates as well a Write Single Block.
Rgds
BT
2020-07-28 12:48 AM
Hi,
regarding you first point " In the code at the picture above, the program never go into the if statement and the function for anticollision is not executed.":
Considering that gNfcDev.techs2do &= ~RFAL_NFC_POLL_TECH_V; at lline 201 then if( ((gNfcDev.disc.techs2Find & RFAL_NFC_POLL_TECH_V) != 0U) && ((gNfcDev.techs2do & RFAL_NFC_POLL_TECH_V) != 0U) ) is always false...
Obviously part of this code is coming from rfal_nfc.c. Just for my understanding, why not using directly the API from rfal_nfc.c in your project?
Rgds
BT
2020-07-28 1:20 AM
Hi Brian, thank you for your reply. I see, the negation yes. But the program still don't want to go into an If statement. I have a feeling that I forgot some function or step which set the states of "gNfcDev".
I'm not using the API because I want to reduce the code as much as possible (I want to have/use only the necessary code )
Best,
Domen
2020-07-28 1:39 AM
Hi Domen,
the RFAL uses compilation switches to reduce the code size. See RFAL FEATURES CONFIGURATION is platform.h
If you need only Type V, the following configuration can be used. This should significantly reduce the code size.
#define RFAL_FEATURE_NFCA false /*!< Enable/Disable RFAL support for NFC-A (ISO14443A) */
#define RFAL_FEATURE_NFCB false /*!< Enable/Disable RFAL support for NFC-B (ISO14443B) */
#define RFAL_FEATURE_NFCF false /*!< Enable/Disable RFAL support for NFC-F (FeliCa) */
#define RFAL_FEATURE_NFCV true /*!< Enable/Disable RFAL support for NFC-V (ISO15693) */
#define RFAL_FEATURE_*** false /*!< Enable/Disable RFAL support for *** (Topaz) */
#define RFAL_FEATURE_T2T false /*!< Enable/Disable RFAL support for T2T */
#define RFAL_FEATURE_T4T false /*!< Enable/Disable RFAL support for T4T */
#define RFAL_FEATURE_ST25TB false /*!< Enable/Disable RFAL support for ST25TB */
#define RFAL_FEATURE_ST25xV true /*!< Enable/Disable RFAL support for ST25TV/ST25DV */
#define RFAL_FEATURE_DYNAMIC_ANALOG_CONFIG false /*!< Enable/Disable Analog Configs to be dynamically updated (RAM) */
#define RFAL_FEATURE_DYNAMIC_POWER false /*!< Enable/Disable RFAL dynamic power support */
#define RFAL_FEATURE_ISO_DEP false /*!< Enable/Disable RFAL support for ISO-DEP (ISO14443-4) */
#define RFAL_FEATURE_ISO_DEP_POLL false /*!< Enable/Disable RFAL support for Poller mode (PCD) ISO-DEP (ISO14443-4) */
#define RFAL_FEATURE_ISO_DEP_LISTEN false /*!< Enable/Disable RFAL support for Listen mode (PICC) ISO-DEP (ISO14443-4)*/
#define RFAL_FEATURE_NFC_DEP false /*!< Enable/Disable RFAL support for NFC-DEP (NFCIP1/P2P) */
#define RFAL_FEATURE_LISTEN_MODE false /*!< Enable/Disable RFAL support for the Listen mode */
#define RFAL_FEATURE_WAKEUP_MODE false /*!< Enable/Disable RFAL support for the Wake-up mode */
Most of Compilers/Linkers can also be configured to remove unused functions.
Rgds
BT
2020-07-28 3:03 AM
Thank you for your advice. I was already try to do this but the program didn't work.
After I change platform file (like It is in your picture) I get an error:
Because Type-F is not important for me I just comment this line and I get no error, just few warnings (about unused variables).
Then I start the program, on the uart terminal get the text: "Welcome to X-NUCLEO-NFC05A1" and"Initialization succeeded.."
After that LED for FieldOn (led106) don't blinking and if I bring the tag close to the device, nothing happened.
I couldn't solved the problem and because of that I start trying with to find different ways to communicate with Tag type-V.
All the best,
Domen
2020-07-28 3:54 AM
Hi,
if the support of some technologies is removed through the RFAL_FEATURE_ flags, the demo.c has to be modified accordingly by removing/emptying demoNfcf, demoAPDU, demoP2P. The discParam.techs2Find in demoIni() has to be modified as well to keep only RFAL_NFC_POLL_TECH_V. Then, this should work.
Rgds
BT
2020-07-28 3:54 AM
Hi again, just un update of the post above. I try to do this again and figured out that the only configuration which is working correctly is this in the picture below:
If I change anything It will stop working (like I describe in previous post).
I went over the program step-by-step and figured out that the program never go into case "RFAL_NFC_STATE_START_DISCOVERY:", because of that also never go into case "RFAL_NFC_STATE_POLL_TECHDETECT:". Consequently It can't detect any technology.
But I can't figure it out why the program don't go into this case.
Best,
Domen
2020-07-28 4:04 AM
HI,
rfalNfcDiscover() returns ERR_DISABLED as the discParam.techs2Find contains technologies that are disabled.
When only NFCV technology is enabled, the discParam.techs2Find shall not contain technologies other than NFCV. The demo will be improved in future release.
Rgds
BT
2020-07-29 2:59 AM
Brian thank you for your explanation. I did it like you said and now It's working.
I also start to write my own program (in the main() loop) with using functions "rfal_nfc.h" and "rfal_nfcv.h" files. I had a big problems with variables because they are declared in different files (fRFALadn gNfcDev) and because of that I can't use the function.
Then I start typing my code in demo.c file. I create a new function and there was the same problems with variables. Because of that I start (for example) instead of "rfalNfcGetDevicesFound( &dev, &devCnt )" using the whole "rfalNfcWorker()" function. At the end, the program was similar as the demoCycle() program.
Can you please explain me where to start and how to use functions from "rfal_nfc.h" and "rfal_nfcv.h" files or how will you start writting the code if you have to make read/write program with Tag type-V.
Please don't lose patience with me, but this "stm32 file structure" confusing me :)
All the best,
Domen
2020-07-29 4:14 AM
Hi,
the easiest way is to use the demo.c as a starting point. This does the basic technology detection activity, anti collision activity etc.
Once a Type V tag has been discovered, the demoCycle calls demovNfcv(). This function demonstrates how to do a Read Single Block (it reads the block 0 and displays its content on the serial log). It demonstrates as well a Write Single Block.
Rgds
BT