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

BLE doesn't enter into DFU/OTA mode.

Dear Team,

Greetings !!!

Device - nRF52832
Softdevice - s132_nrf52_6.0.0
IDE - segger embedded studio
Bootloader - secure bootloader

In our current application, We are using hardware watchdog timer which timeout is 2 sec. It means we are sending continuous pulses to watch dog timer using app timer. If watch dog timer does not get pulses for 2 seconds then it will reset the device. It works perfectly for our application without DFU/OTA.

I have followed the DFU procedure as per nordic application note and it works perfectly without hardware watchdog timer. The problem causes with Hardware WDT.

First, i download the secure bootloader in our device and browse the .zip file then application is successfully updated into the device. The problem occured when i tried to jump into secure bootloader from application, it does not jump into boot loader and device get reset. In short, i could not enter into the DFU mode further.

Your quick reply would be highly appreciated.

Thanks

  • Thanks for the quick response
    Is there any approach i can follow?

    currently i am trying to add a Timer to reset the external bootloader at 1 sec through GPIO(high pulse).

    This is what i have done in my application code, and works perfectly.

    But trying out this in bootloader code switched off the BLE advt.

    let me know how can i modify the bootloader code to achieve the above desired effect.

  • The code below should read back the UICR registers and I have marked the section where you should modify the values. Again, apply this at your own risk. 

        // Storage buffers and variables to hold the UICR register content
        static uint32_t uicr_buffer[59]    = {0x00000000};
        static uint32_t pselreset_0        = 0x00000000;
        static uint32_t pselreset_1        = 0x00000000;
        static uint32_t approtect          = 0x00000000;
        static uint32_t nfcpins            = 0x00000000;
        
        CRITICAL_REGION_ENTER();
      
        // Read and buffer UICR register content prior to erase
        uint32_t uicr_address = 0x10001014;
    
        for(int i = 0; i<sizeof(uicr_buffer); i++)
        {
            uicr_buffer[i] = *(uint32_t *)uicr_address; 
            while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
            // Set UICR address to the next register
            uicr_address += 0x04;
        }
      
        pselreset_0 = NRF_UICR->PSELRESET[0];
        pselreset_1 = NRF_UICR->PSELRESET[1];
        approtect   = NRF_UICR->APPROTECT;
        nfcpins     = NRF_UICR->NFCPINS;
        
        //Modify UICR values here
        
       
        // Enable Erase mode
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een << NVMC_CONFIG_WEN_Pos; //0x02; 
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
        
        // Erase the UICR registers
        NRF_NVMC->ERASEUICR = NVMC_ERASEUICR_ERASEUICR_Erase << NVMC_ERASEUICR_ERASEUICR_Pos; //0x00000001;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
       
        // Enable WRITE mode
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos; //0x01;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    
        // Write the modified UICR content back to the UICR registers 
        uicr_address = 0x10001014;
        for(int j = 0; j<sizeof(uicr_buffer); j++)
        {
            // Skip writing to registers that were 0xFFFFFFFF before the UICR register were erased. 
            if(uicr_buffer[j] != 0xFFFFFFFF)
            {
                *(uint32_t *)uicr_address = uicr_buffer[j];
                // Wait untill the NVMC peripheral has finished writting to the UICR register
                while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}                
            }
            // Set UICR address to the next register
            uicr_address += 0x04;  
        }
    
        NRF_UICR->PSELRESET[0]  = pselreset_0;
        NRF_UICR->PSELRESET[1]  = pselreset_1;
        NRF_UICR->APPROTECT     = approtect;
        NRF_UICR->NFCPINS       = nfcpins;
    
        CRITICAL_REGION_EXIT();

     

    Prajapati said:

    currently i am trying to add a Timer to reset the external bootloader at 1 sec through GPIO(high pulse).

    This is what i have done in my application code, and works perfectly.

    But trying out this in bootloader code switched off the BLE advt.

     So the bootloader should set a GPIO high after one second to reset an external chip?

Related