Problem with NFCT when approaching a magnetic field (Mobile phone)

Hi!

I'm developing a project with functional FreeRTOS (I started from the blinky_freertos example) on the DK nRF52840 with the nRF5_SDK_17.1.0_ddde560 version, and now I'm incorporating the "record_url" example into one of my threads. The program compiles correctly, and when I execute nfc_t2t_setup(nfc_callback, NULL);, nfc_uri_msg_encode(NFC_URI_HTTP_WWW, m_url, sizeof(m_url), m_ndef_msg_buf, &len);, nfc_t2t_payload_set(m_ndef_msg_buf, len);, and nfc_t2t_emulation_start();, it always returns NRF_SUCCESS.

However, problems arise when I bring the phone close to the device:

The program freezes at this point (gcc_startup_nrf52840.S).

Additionally, the NFC interrupt is not executed.

Do you have any idea what might be happening? Thanks!

  • Hi

    Is there a specific reason you're using the nRF5 SDK and not the nRF Connect SDK? Since you're using an RTOS I think it's worth noting that we would recommend using the Zephyr RTOS that the nRF Connect SDK is based on. More information on that in our nRF Connect SDK vs. nRF5 SDK statement here. What are you trying to achieve exactly, is the phone supposed to read the NFC tag and the URL you're broadcasting? Are you working on an nRF52840 DK or a custom board? If it's a custom board I'm interested in seeing your NFC antenna and circuitry. 

    Best regards,

    Simon

  • Hi Simon,

    Thanks you for the response. 

    As I mentioned earlier, I'm using the DK nRF52840 and as for RTOS, I opted for FreeRTOS, since it's the one I'm familiar with and I currently have no intention of changing.

    Regarding NFC, I'm using the DK's antenna and trying to read the tag (in my case, I want it to be a URL) with the phone.

    All the different NFC stages are initialized correctly, but when I bring the phone close to the antenna, the program stops working.

    It seems that the magnetic field of the phone is detected by the DK, but it can't handle it correctly because it freezes at the point I mentioned before.

  • The interrupt handler for the NFC is not being correctly set and so the default vector is used. One of the setup calls needs fixing; maybe check to see any functions are returning failure, or look at an example showing the handler setup.

    Edit: Actually I looked at sdk17.1 and don't see default_handler, (not gcc, IAR) but this is same issue:

            PUBWEAK  NFCT_IRQHandler
            SECTION .text:CODE:REORDER:NOROOT(1)
    NFCT_IRQHandler
            B .
            

    Oh I see the handler in gcc is set via a macro (macros killed off the SDK ..):

    /* IRQ Handlers */
    
        .globl  Default_Handler
        .type   Default_Handler, %function
    Default_Handler:
        b       .
        .size   Default_Handler, . - Default_Handler
    
        .macro  IRQ handler
        .weak   \handler
        .set    \handler, Default_Handler
        .endm
    

Related