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

NFC and LFCLK initialization

I'm experiencing a problem with the NFC.

I'm trying to make a simple read-only tag, and I've used the NFC Text Record Example to build upon. That worked without a problem.

However, when I integrated the NFC code in my project, I wasn't able to read out the tag any more, the reader said it was empty. However, I got no error code from the nfc library/code.

When I shuffled my code around, I found out that the problem has to do with the low frequency clock configuration I used:

void LFCLK_Config(void)
{
    ret_code_t err_code = nrf_drv_clock_init();
    APP_ERROR_CHECK(err_code);

    nrf_drv_clock_lfclk_request(NULL);
}

If I configure the LFCLK first, the program runs, but the NFC tag is empty. If i configure the NFC first, I'll get a NRF_ERROR_MODULE_ALREADY_INITIALIZED error from the nrf_drv_clock_init() call. Unfortunately, I need the LFCLK to drive my RTC.

I havn't found anything in the documentation that forbits the use of LFCLK when using NFC (using nRF52840, there shouldn't even be the timer 4 restriction).

Is there a way to solve this?

I'm using a nRF52840 and SDK version 15.

I've found the Patch for nrf_nfct_field_event_handler() function and applied it; it made no difference.

Best regards,

     Lasse

Parents
  • The nrf_drv_clock_init() is already run by the NFC example: fc_t2t_setup(..)-->hal_nfc_setup(..)-->nrf_drv_clock_init().

    In the LFCLK_Config() function try to run nrf_drv_clock_init_check() first, and only initialize the clock module if it is not already initialized.

    Best regards,

    Simon

  • Hello Simon,

    I don't have to check if the clock module is initialized; when I initialize the NFC first, it always is.

    Not executing the code in LFCLK_config() doesn't do what I need:

    Skipping

    ret_code_t err_code = nrf_drv_clock_init();

    let's me use the LFCLK for my application; the NFC tag is readable, but empty.

    Also skipping

    nrf_drv_clock_lfclk_request(NULL);

    the Tag is readable and contains the data I configured with NFC_NDEF_TEXT_RECORD_DESC_DEF, but the LFCLK isn't avaliable (more precisely: my RTC handler won't be called).

Reply
  • Hello Simon,

    I don't have to check if the clock module is initialized; when I initialize the NFC first, it always is.

    Not executing the code in LFCLK_config() doesn't do what I need:

    Skipping

    ret_code_t err_code = nrf_drv_clock_init();

    let's me use the LFCLK for my application; the NFC tag is readable, but empty.

    Also skipping

    nrf_drv_clock_lfclk_request(NULL);

    the Tag is readable and contains the data I configured with NFC_NDEF_TEXT_RECORD_DESC_DEF, but the LFCLK isn't avaliable (more precisely: my RTC handler won't be called).

Children
Related