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

Butttonless DFU issue with CONFIG_NFCT_PINS_AS_GPIOS

I am using nrf52832 for button less DFU. DFU is working fine when  CONFIG_NFCT_PINS_AS_GPIOS is not added in applicaton. When added seems like code is getting reset at bootloader level. Is any connection with CONFIG_NFCT_PINS_AS_GPIOS ? Please suggest.

Thanks

Parents Reply Children
  • Oh, so you're actually reaching the nrf_bootloader_app_start_final() function?

    Any errors here will not cause a reset, just generate a log output. 

    If app_start(vector_table_addr) is executed, then it means that the bootloader is branching to the application, i.e. the reset must be occuring in the application, not the bootloader. 

    Can you try to debug the application by attaching to the running code in Segger Embedded Studio ( Target->Attach debugger) with the application project used to generate the application hex for the DFU image?

  • I tried but seems like code is not coming at main of application. I but breakpoint at starting but its not reaching till that point. Thanks

  • Ok, but you confirmed that app_start() is run til the end in the bootloader? You can also try to set a breakpoint in SystemInit() in system_nrf52.c. This function is called before main().

    Best regards

    Bjørn

  • I put breakpoints at SystemInit() at application code, and code is going inside SystemInit().  I feel application is resetting inside defined (CONFIG_NFCT_PINS_AS_GPIOS) at NVIC_SystemReset(). Is this correct ?


     

  • Below is the code inside, Not sure UICR_NFCPINS_PROTECT_Msk, UICR_NFCPINS_PROTECT_Pos ,


    /* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined,
    two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as
    normal GPIOs. */
    #if defined (CONFIG_NFCT_PINS_AS_GPIOS)
    if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)){
    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    NVIC_SystemReset();
    }
    #endif

Related