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

switching to dfu without reset

Hi,

My system needs to maintain certain gpio at their state at all times, including when switching to bootloader,

I understand that reset will also return my gpios to input mode,

Is there a solution ? 

Maybe a way to switch to dfu/bootloader without reset ?

I would appreciate some insights/ideas/examples on this issue

Thanks

Eran

Parents
  • Reset will set GPIOs to inputs. Use pull up and pull down resistors if you need to maintain the logic levels at all times.

  • Hi,

    I would really appreciate some help with a good solution to switch between application and dfu without going through reset

    Thanks !

    Eran

  • Okay, you can try to do such a perilous thing - disable SoftDevice, disable interrupts, ensure that no peripherals are running and you're not using flash protection module, call sd_softdevice_vector_table_base_set(BOOTLOADER_ADDRESS), then set GPREGRET register and pass control directly to bootloader in some way like this:

    typedef void (*jmp_to_boot)(void);

    ((jmp_to_boot)(BOOTLOADER_ADDRESS+1))();

    Maybe this will work. But your idea with pin is somewhat strange - are you sure that no reset will occur because of other reasons (power glitches, exceptions in the code, etc)? It's a good practice to use a watchdog that will reset MCU in case if something went wrong. I still can't get the purpose of this pin - to hold power enable? for tamper protection? maybe there's another option to solve this at hardware level?

  • Hi Dimitry,

    Thanks for those inputs.

    The reason for this Configuration and requirement :

    the uC is powered by a voltage regulator.

    The voltage regulator is POWERED by a battery or external charger/external power.

    the voltage regulator is ENABLED by the uC or the external charger.

    The battery is not enabling the voltage regulator

    once the system connected to charger, the charger enables the regulator - thus the uC awakes and than holds a GPIO that maintains the voltage regulator by itself, in this point we can disconnect the external charger and the voltage regulator will still be enabled by the GPIO. , self maintained by the GPIO.

    However - if we reset, the GPIO drops and than the regulator will be disable, the uC will have no power to awake from reset and we could not continue with the bootloader.

    Thanks 

    Eran

Reply
  • Hi Dimitry,

    Thanks for those inputs.

    The reason for this Configuration and requirement :

    the uC is powered by a voltage regulator.

    The voltage regulator is POWERED by a battery or external charger/external power.

    the voltage regulator is ENABLED by the uC or the external charger.

    The battery is not enabling the voltage regulator

    once the system connected to charger, the charger enables the regulator - thus the uC awakes and than holds a GPIO that maintains the voltage regulator by itself, in this point we can disconnect the external charger and the voltage regulator will still be enabled by the GPIO. , self maintained by the GPIO.

    However - if we reset, the GPIO drops and than the regulator will be disable, the uC will have no power to awake from reset and we could not continue with the bootloader.

    Thanks 

    Eran

Children
Related