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

Switch to BLE DFU mode

Hello !

I have two devices with the same firmware, to switch in DFU mode I call this function :

void system_reset_to_dfu(void)
{
    NRF_POWER->GPREGRET = 0;
    NRF_POWER->GPREGRET = 0xB1;
    system_reset();
}

On the first device, I reset in BLE DFU mode.

On the others devices I reset in normal mode ... But I can read 0xB1 in NRF_POWER->GPREGRET register.

Do I need to allow BLE DFU mode somewhere ?

Any clues ?

Thanks Automn

Parents
  • Hi.

    I think the issue is that you're not forcing memory write before you write to the same register twice.

    Try this instead:

    void system_reset_to_dfu(void)
    {
        NRF_POWER->GPREGRET = 0;
        __DSB();
        NRF_POWER->GPREGRET = 0xB1;
        system_reset();
    }

    But why would you set it to 0 in the first place?

    Best regards,

    Andreas

  • Thanks for the quick answer,

    I try with your code, I get set same result.

    I also replace the code with nrf_function :

    void system_reset_to_dfu(void)
    {
        nrf_power_gpregret_set(0xB1);
        __DSB();
        system_reset();
    }

    It's the same, DFU work on my old device, but not on the new one.

    At the restart I can read 0xB1 in the register :

    log_info("NRF_POWER->GPREGRET = 0x%x", nrf_power_gpregret_get());
    
    INFO - NONE - 0 - NRF_POWER->GPREGRET = 0xb1␊

    Do I need to defined something in sdk_config.h ?

    Best regards,

    Automn

Reply
  • Thanks for the quick answer,

    I try with your code, I get set same result.

    I also replace the code with nrf_function :

    void system_reset_to_dfu(void)
    {
        nrf_power_gpregret_set(0xB1);
        __DSB();
        system_reset();
    }

    It's the same, DFU work on my old device, but not on the new one.

    At the restart I can read 0xB1 in the register :

    log_info("NRF_POWER->GPREGRET = 0x%x", nrf_power_gpregret_get());
    
    INFO - NONE - 0 - NRF_POWER->GPREGRET = 0xb1␊

    Do I need to defined something in sdk_config.h ?

    Best regards,

    Automn

Children
Related