I"m trying to add a setting to our device such that when a button is pressed it does a hard reset of the board (as if it had just booted up after being flashed). I found SWRESET in the docs but I get an error when trying to use it:
./lib/sdk/bsp/include/sdk_defs.h:725:29: error: 'GPREG_DEBUG_REG_SW_RESET_Pos' was not declared in this scope
REG_SET_BIT(GPREG, DEBUG_REG, SW_RESET); \
^
./lib/sdk/bsp/include/sdk_defs.h:641:37: note: in definition of macro 'REG_SET_BIT'
base->reg |= (1 << (base##_##reg##_##field##_Pos)); \
How would you recommend triggering the reset from the embedded code?
Device:
Hi alarner,
What exactly is your use case ? What exactly is that you need ? You cannot issue a hw reset via sw, since you would like to use a button you can use the reset pin of the device, if this is not an option and you would like to issue a hw reset via sw then you can force a watchdog reset and this will force a hw reset. You can have a look at the suota_loader project the following functions trigger_reboot() for forcing a hw reset over sw and the reboot() function for issuing a sw reset. In the hw reset the bootloader will run, that is not the case in the sw reset.
Thanks MT_dialog