I am using nRF52832 and want to include BLE-NFC pair feature in the application that i am trying to develop. I am using SDK v14.2, Segger embedded studio as compiler and Softdevice version v5.0 on a windows platform.
Setup: Initially, i tried example ble_app_hrs_nfc_pairing and included ble nus service to it on nrf52 DK (PCA10040, v1.2.1). It worked perfectly well. So now, having tested the functionality i tried porting the same on to my custom board to evaluate the ble-nfc pairing feature.
Problem: There is no error during compilation. But when i try to bring a smartphone near to the board to test the pairing, NFC is not at all working. While debugging, i see that the NFC_IRQHandler is not called, so seems like NFC field is not detected so as to start sensing and pairing.
I checked the peak to peak differential threshold voltage to see if the voltage level is too low for NFC to sense the field, but that is also fine (around 2.4 V, once i bring in the smartphone near to the NFC antenna).
Could anyone of you please let me know what could be the reasons that NFC is not able to work? Or any configurations/ macros i might have missed to support the feature?
Any help is appreciated.
Have you seen this? http://infocenter.nordicsemi.com/pdf/nwp_026.pdf It could be as easy as the antenna isn't resonating at the correct frequency.
Thank you ketiljo for that link. However, after discussing this with the electronics design guy, he told that we are using the same values for the capacitance as those on the nRF52 DK (PCA10040 board). We are using the same antenna which comes with DK too.
Will it not show the same behavior if we are going to use exactly the same values and antenna? Please advise.
Another question that i had here is that if the antenna frequency is not tuned, then when we bring the smartphone in the NFC range, should there be any spike in the voltage? I ask this because i see a spike in the voltage level on the oscilloscope when i try to pair via NFC :(
Do you have a 32 kHz crystal on your board? The DK has one so if you don't and haven't configured your FW to use the 32 kHz RC oscillator, it will fail.
If the antenna is identical, you could use the same capacitor values
Yes, we have 32KHz crystal on our board. And looking at the sdk.config.h file, it's using XTAL clock source.
// <0=> NRF_CLOCK_LF_SRC_RC // <1=> NRF_CLOCK_LF_SRC_XTAL // <2=> NRF_CLOCK_LF_SRC_SYNTH
#ifndef NRF_SDH_CLOCK_LF_SRC#define NRF_SDH_CLOCK_LF_SRC 1#endif
If i change the value to 0 to have RC clock source, ble_stack_init() throws an Invalid param error. :(
Looking into the ble_app_hrs_nfc_pairing example, i found the value of LF_SRC to be 1 too.
Hi ketiljo, I tried by configuring LF clock source to 32KHz RC oscillator and followed steps given here as well -> https://devzone.nordicsemi.com/f/nordic-q-a/15363/change-clock-source-nrf52832-app-beacon-example
This did solve the invalid param error mentioned above, but NFC is still not working. :(
Ok, so the oscillator is not the problem then.
When the NFC module is active, you should see a little less than VDD/2 on NFC1 or NFC2 with reference to ground.
So you see the same voltage swing on the DK and on your board?
Have you changed anything from the DK design? Is the antenna physically the same or have you made it on the PCB? Can you check the center frequency of the antenna with one of the two methods shown in the whitepaper?
Attached, you will find 2 images from the oscilloscope (1 for the DK and the other for custom board). Yellow line indicates the differential voltage between NFC pins.
Unfortunately, we were not able to find the center frequency since we do not have of either of the instruments required to carry out the tuning methods.
But, after debugging much, i saw that NFCPINS register had GPIO enabled. (I had configured NFC pins to GPIO before and i thought that by just removing the macro CONFIG_NFCT_PINS_AS_GPIOS would make them NFC pins again. I was wrong to think that way.
Configured the pins back to NFC antenna pins by erasing uicr register and doing a system reset. Now the NFC works fine.
Thanks for the help!!
Good that you found the cause. Note that the pins may be damaged if you use them for NFC while setup as GPIOs. That's why they are set as NFC as default. If you see any problems, replace the chip first just in case.