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
  • Sorry I was offline last week.

    As you suggested, I set a breakpoint at the if statement after nrf_dfu_settings_write_and_backup() call in nrf_dfu_settings_init() ,I found there is no error so on_error() in main is not getting called.

    Thanks

  • Ok, so you reach the return NRF_SUCCESS statement at the end of nrf_dfu_settings_init()? If not then it could be the settings_forbidden_parts_copy_from_backup() function that tries to write data to a protected region. Can you check the value of the pointer passed to settings_forbidden_parts_copy_from_backup()?

    Best regards

    Bjørn

  • Basiclly issue is as I am enabling CONFIG_NFCT_PINS_AS_GPIOS, NRF_UICR->NFCPINS should be disable, each reset it tries to do so but its coming always enable. I tried adding CONFIG_NFCT_PINS_AS_GPIOS in boot loader still its not working.

    Please suggest asap as this is bit urgent. 

    Thanks

  • Also In bootloader I was removing P21 as reset pin. i want to use it for GPIO and below is the code for same.

    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een << NVMC_CONFIG_WEN_Pos;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){};
    NRF_NVMC->ERASEUICR = NVMC_ERASEUICR_ERASEUICR_Erase;
    NRF_UICR->PSELRESET[0] = 0xFFFFFFFF ;
    NRF_UICR->PSELRESET[1] = 0xFFFFFFFF ;
    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}

    When I removed this part, DFU is working fine. I am not sure how this part is causing issue.

    Thanks

  • If you do not want to use pin 21 as the reset pin then you should remove the CONFIG_GPIO_AS_PINRESET definition from the preprocessor definitions, not comment out the code.

    Where you running the code above, i.e.

    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een << NVMC_CONFIG_WEN_Pos;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){};
    NRF_NVMC->ERASEUICR = NVMC_ERASEUICR_ERASEUICR_Erase;
    NRF_UICR->PSELRESET[0] = 0xFFFFFFFF ;
    NRF_UICR->PSELRESET[1] = 0xFFFFFFFF ;
    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
    while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}

    in the bootloader? If so it is no wonder the chip kept resetting as the following code will be executed in the application by SystemInit() in system_nRF52.c if CONFIG_GPIO_AS_PINRESET is defined 

        #if defined (CONFIG_GPIO_AS_PINRESET)
            if (((NRF_UICR->PSELRESET[0] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos)) ||
                ((NRF_UICR->PSELRESET[1] & UICR_PSELRESET_CONNECT_Msk) != (UICR_PSELRESET_CONNECT_Connected << UICR_PSELRESET_CONNECT_Pos))){
                NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_UICR->PSELRESET[0] = 21;
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
                NRF_UICR->PSELRESET[1] = 21;
                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

    As you can see it will write pin 21 to the PSELRESET registers and then perform a System Reset for the change to take effect. So you when you set the PSELRESET to 0xFFFFFFF in the bootloader, then the application would write them back to pin 21 and then reset. This would be repeated for infinity. 

    So just remove CONFIG_GPIO_AS_PINRESET in both the application and the bootloader project and you should see things behave as normal. 

    Best regards

    Bjørn

  • Yes actually i already removed it my code. For safe side I added to reconfig PSELRESET. I removed everything, now its working fine.

    Thanks

Reply Children
No Data
Related