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

NFC problem on nRF52840 when using mesh DFU bootloader.

I have developped an application using bluetooth mesh with NFC to read a text record. I am currently using the nRF52840 DK Rev 2.0.1 2020.11.

Regarding my software setup I am using the nrf mesh sdk v4.2.0 and nrf sdk v.17.0.0.

My application use the s140_nrf52_7.0.1_softdevice along with the mesh_bootloader_gccarmemb_nrf52840_xxAA to perform OTA DFU. Along with the BL, SD and APP i am flashing a corresponding device page (with a public key) that seems to work without a problem to accept DFU packets.

My issue is with NFC tag reader. If I only flash the application with the softdevice, I can read the NFC tag with my phone. However when flashing the APP + SD + BL + devicepage, I cannot read the NFC tag. That is very strange and nothing happened when i try to read the  NFC. 

Here is my NFC function that init the module.

void nfc_init(nfc_t2t_callback_t callback)
{
    ret_code_t err_code;

    /* Set up NFC */
    err_code = nfc_t2t_setup(callback, NULL);
    APP_ERROR_CHECK(err_code);

    /* Encode NFC message */
    err_code = nfc_msg_encode(m_ndef_msg_buf, &m_ndef_msg_len);
    APP_ERROR_CHECK(err_code);

    /* Set created message as the NFC payload */
    err_code = nfc_t2t_payload_set(m_ndef_msg_buf, m_ndef_msg_len);
    APP_ERROR_CHECK(err_code);

    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "NFC init\n");

    /* Start sensing NFC field */
    err_code = nfc_t2t_emulation_start();
    APP_ERROR_CHECK(err_code);
}

and this is the NFC config

#define NFC_NDEF_MSG_TAG_TYPE 2
#define NRFX_NFCT_ENABLED 1
#define NRF_CLOCK_ENABLED 1
#define TIMER_ENABLED 1
#define TIMER4_ENABLED 1
#define NFC_NDEF_MSG_ENABLED 1
#define NFC_NDEF_RECORD_ENABLED 1
#define NFC_NDEF_TEXT_RECORD_ENABLED 1
#define NFC_PLATFORM_ENABLED 1

The mesh OTA DFU works without a problem... I just got issues when trying to scan the NFC tag... nothing happened!
Any comment on this issue is appreciated!

Parents
  • Hello,

    As you said in your private ticket, the clock is started in the bootloader, and it works if you comment out this in the bootloader. In that case, I would recommend that you make sure it is running from the application.

    Did you try to debug the application before modifying the bootloader? Does the application run into any issues? Is the error handler picking up something, or is the application running as before?

    Best regards,

    Edvin

  • Hello Edvin,

    As i mentioned before, I had no issues when running just the application and softdevice without the bootloader, 

    Commenting out the clock_init() in the mesh bootloader seems to fix the NFC issue. It does not either seems that the application run into issues. And above all the NFC works again! I guess the softedvice configure and start the clock but not sure about it!

  • The softdevice will start the clocks, yes. 

    What I find strange is that if the bootloader starts the clock, the NFC doesn't work. However, as long as you start the clock from your application (which the softdevice does), it shouldn't matter that you comment it out in the bootloader. 

    Perhaps it is one of the init functions in the NFC libraries that doesn't like that the clocks are running from the start. 

    Your bootloader still works, right? After you comment out the clock init function?

    BR,

    Edvin

  • Yes the bootloader still working! 
    It feels actually strange that initiating the clock in the bootloader affects the NFC.

  • It may be that the NFC is checking whether the clock is running, and requesting the clock only if it is not. 

    What SDK version and mesh SDK version are you using? 

    I have not been able to replicate this, but I have not imported the NFC libraries to a mesh example. I tried to add the same init_clock function to the beginning of the record_text nfc example from SDK17. I did not find any issues there. What does it behave like? Does the app crash when you don't comment out the init_clock function in the bootloader? What does the application behave like? Is the main() function reached? Is the nfc init function reached? Does it return any errors?

    If you are content with the workaround to comment out the init_clock() function from the bootloader, that is perfectly fine. No need to reply. If you want to try to find the reason, we can continue to dig a bit for the reason for this issue. If so, do you have a mesh example that replicates this issue when you program the default bootloader?

    BR,

    Edvin

Reply
  • It may be that the NFC is checking whether the clock is running, and requesting the clock only if it is not. 

    What SDK version and mesh SDK version are you using? 

    I have not been able to replicate this, but I have not imported the NFC libraries to a mesh example. I tried to add the same init_clock function to the beginning of the record_text nfc example from SDK17. I did not find any issues there. What does it behave like? Does the app crash when you don't comment out the init_clock function in the bootloader? What does the application behave like? Is the main() function reached? Is the nfc init function reached? Does it return any errors?

    If you are content with the workaround to comment out the init_clock() function from the bootloader, that is perfectly fine. No need to reply. If you want to try to find the reason, we can continue to dig a bit for the reason for this issue. If so, do you have a mesh example that replicates this issue when you program the default bootloader?

    BR,

    Edvin

Children
  • Here is my different versions I use:

    nrf mesh sdk v4.2.0
    nrf sdk v.17.0.0
    softdevice s140_nrf52_7.0.1_softdevice
    mesh_bootloader_gccarmemb_nrf52840_xxAA

    When using NFC library with a mesh application and default mesh bootloader everything seems to work fine ...main is reached nfc init function is reached without problem , no crashes no errors BUT I cant scan the NFC tag with my phone ... nothing is detected!

Related