Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NFC pairing fails due to NRF_DRV_CLOCK_EVT_HFCLK_STARTED not being raised

I have trouble getting NFC-pairing to work in nRF52840 running SoftDevice 7.2 based on SDK 7.0.2. 
The observed behaviour is that the NFC Field is detected but nothing more.

My RTT log looks like this:

<info> NFCT: Start
<debug> NFCT: Field detected
<debug> nfc_platform: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field detected

while the nfc pairing reference example works flawlessly, the debug output looks like that:

<info> NFCT: Initialized
<info> NFCT: Start
<info> app: NFC Connection Handover BLE peripheral device example started.
<debug> NFCT: Field detected
<debug> nfc_platform: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field lost
<debug> nfc_platform: Field lost
<debug> NFCT: Field detected
<debug> nfc_platform: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field lost
<debug> nfc_platform: Field lost
<debug> NFCT: Field detected
<debug> nfc_platform: Field detected
<debug> NFCT: Field detected
<debug> NFCT: Field detected
<debug> nfc_ble_pair: NFC_EVENT_FIELD_ON
<info> BLE_M: Fast advertising.
<debug> NFCT: Selected
<debug> NFCT: Rx fend
<debug> NFCT: Selected

After some digging (and reading nrf52840 datasheet), I figured that the reason might be 
missing nfc module getting set in active mode. 
In nfc_platform.c that happens by calling nrfx_nfct_state_force(NRFX_NFCT_STATE_ACTIVATED); 
commenting out that line and running the nfc-example again shows the same behaviour
(and debug-output) as with my app. 
Debugging my app again reveals that the clock_event_handler in nfc_platform.c that would ACTIVATE NFC is never 
called and neither is the nrfx_power_clock_irq_handler called.
Comparing SDK configurations between my Application and the nfc pairing example shows 
no differences in CLOCK configuration or NFC-configuration. Also, both have SoftDevice active and both NRFX_CLOCK_ENABLED
as well as NRF_CLOCK_ENABLED set as well..
I would expect the SoftDevice to forward the IRQ to the application but it doesn't. 
It looks to me as if joel-sc is facing the same problem here: 

https://devzone.nordicsemi.com/f/nordic-q-a/75069/nfc-doesn-t-work-when-the-softdevice-is-enabled/309655#309655

So, can anyone give me a hint to why the clock IRQ is not raised (or rather forwarded) by the SoftDevice?

Thank you very much.

Parents
  • Hi

    Due to the summer vacation period we are currently understaffed, so delayed replies must be expected. I am sorry about any inconvenience this might cause.

    Glad you were able to figure it out on your own! The HF clock peripheral is one of the peripherals reserved for the SoftDevice, so if you try requesting the HF clock before the SoftDevice is started, it will fail to start properly, as the SoftDevice requires full control of the HF clock , and will be able to handle it from there.

    Best regards,

    Simon

Reply
  • Hi

    Due to the summer vacation period we are currently understaffed, so delayed replies must be expected. I am sorry about any inconvenience this might cause.

    Glad you were able to figure it out on your own! The HF clock peripheral is one of the peripherals reserved for the SoftDevice, so if you try requesting the HF clock before the SoftDevice is started, it will fail to start properly, as the SoftDevice requires full control of the HF clock , and will be able to handle it from there.

    Best regards,

    Simon

Children
No Data
Related