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
  • HI chandan, 

    which SDK and which SoftDevice version are you using?

    If the CONFIG_NFCT_PINS_AS_GPIOS is defined, then the following code will be compiled into and run by SystemInit() on startup. 

        #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

    This code will simply configure the NFC pins as GPIOs and these pins are not used by the bootloader at all. If CONFIG_NFCT_PINS_AS_GPIOS is defined in the bootloader project, then the bootlaoders SystemInit() will run the snippet first and when jumping to the application it will see that the pins are already configured and not run the code as you can see from the if statement. Hence, whether CONFIG_NFCT_PINS_AS_GPIOS is defined or not in the application should not affect the bootloader or the DFU process in any way. 

    Can you provide more details on what the issue is? When exactly does the reset occur?Can you provide logs from the debug output from the bootloader on the nRF52832?

    Best regards

    Bjørn

Reply
  • HI chandan, 

    which SDK and which SoftDevice version are you using?

    If the CONFIG_NFCT_PINS_AS_GPIOS is defined, then the following code will be compiled into and run by SystemInit() on startup. 

        #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

    This code will simply configure the NFC pins as GPIOs and these pins are not used by the bootloader at all. If CONFIG_NFCT_PINS_AS_GPIOS is defined in the bootloader project, then the bootlaoders SystemInit() will run the snippet first and when jumping to the application it will see that the pins are already configured and not run the code as you can see from the if statement. Hence, whether CONFIG_NFCT_PINS_AS_GPIOS is defined or not in the application should not affect the bootloader or the DFU process in any way. 

    Can you provide more details on what the issue is? When exactly does the reset occur?Can you provide logs from the debug output from the bootloader on the nRF52832?

    Best regards

    Bjørn

Children
Related