This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NFC stops working

Hello Devzone,

For my project I am using NFC and I am using the writeable NDEF message project as an example.

Everything is working except I have found one issue.

Whenever I receive the NFC_T4T_EVENT_FIELD_ON event and I get an interrupt that takes time to complete NFC stops working.

I can still read and write my device but the NFC_T4T_EVENT_NDEF_UPDATED is never triggered.

I use this event to process all incoming data.

This issue can be easily reproduced by adding the following code in the NFC_T4T_EVENT_FIELD_ON event

uint32_t temp = 100000;
while(--temp); // Simulate interrupt by "waiting" in event.

How can I solve this problem that the NFC_T4T_EVENT_NDEF_UPDATED  will be triggered if I receive an interrupt in the NFC_T4T_EVENT_FIELD_ON event?

Parents
  • Hi

    The update came in after I left the office for the day, so sorry about the delay.

    What happens is that the T4T library works in interrupts - meaning once the application calls the nfc_t4t_emulation_start() function, the library will handle the NFCT IRQs and will react to these IRQs by configuring the peripheral: E.g on an RXFRAMEEND IRQ it will configure the response frame for transmission with the payload prepared by the application. If the library is not able to react to an IRQ in time it will most likely cause a communication error with the NFC reader.

    In this case, I think the solution would be to decouple the NFCT IRQs from the application IRQs by changing their respective priority levels in NVIC. There are sdk_config.h options for this in both the app_timer and the NFC T4T library. Please try editing these so that the NFC IRQs don't get interrupted (have higher priority than timer interrupts).

    Best regards,

    Simon

Reply
  • Hi

    The update came in after I left the office for the day, so sorry about the delay.

    What happens is that the T4T library works in interrupts - meaning once the application calls the nfc_t4t_emulation_start() function, the library will handle the NFCT IRQs and will react to these IRQs by configuring the peripheral: E.g on an RXFRAMEEND IRQ it will configure the response frame for transmission with the payload prepared by the application. If the library is not able to react to an IRQ in time it will most likely cause a communication error with the NFC reader.

    In this case, I think the solution would be to decouple the NFCT IRQs from the application IRQs by changing their respective priority levels in NVIC. There are sdk_config.h options for this in both the app_timer and the NFC T4T library. Please try editing these so that the NFC IRQs don't get interrupted (have higher priority than timer interrupts).

    Best regards,

    Simon

Children
  • No problem about the delay.

    Thank you for this answer, this is very useful.

    I checked the sdk_config.h file and I saw that the NRFX_NFCT_CONFIG_IRQ_PRIORITY is set to 6 and that the APP_TIMER_CONFIG_IRQ_PRIORITY was also set to 6.

    This will indeed result in stopping the NFC interrupt from firing when the app timer interrupt is taking time. 

    I have changed the NRFX_NFCT_CONFIG_IRQ_PRIORITY  to 5 and this solves the problem. 

    Two more questions,

    1.) In some occurrences with setting interrupt priority in the sdk_config.h file they mention that the softdevice uses interurpts 0, 1, 4 and 5 while the softdevice manual specifies that it only uses 0, 1 and 4. Is 5 safe to use?

    2.) In previous SDK's (15.0.0)  the app timer had an interrupt priority of 7 and this is now set to 6, is it safe to set this back to 7 or does the softdevice use the app timer for things when BLE is active and it requires this interrupt to be at priority 6?

    Thanks and much appreciated for all the help. 

Related