This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to reset the MCU the same way as the pinreset command in Zephyr?

Hello,

I have a situation where I would like to reset the MCU (nRF52832) under Zephyr. For the most part I use ```sys_reboot(SYS_REBOOT_COLD)```. However, I would need a different kind of reset. Essentially, I would like to reproduce the "nrfjprog --pinreset" command. Is there a way to do that from the C code?

Thank you for any help.z

Best regards,

  • Hi,

    The only way to do a pin reset from firmware is to connect a GPIO to the reset pin and control it. That is possible, and is for instance done by the USB DFU trigger library in the nRF5 SDK, see <SDK>components\libraries\bootloader\dfu\nrf_dfu_trigger_usb.c. (I mention that as a reference even though it is a different SDK as the code itself here is trivial, just configuring a GPIO as output and clearing it).

    By the way, why do you need a pin reset? You can see how different resets behave differently in the reset behavior table.

  • I should have been clearer. I just need something that behaves the same way as a pin reset. Using the table, I can see that watchdog reset would suffice. Is there a way to force one directly ?

  • The fastest way to trigger a watchdog reset is to configure the watchdog with the minimal reload value (set WDT.CRV to 0xF) and start it, and don't feed it. That way the WDT will time out after ~458 µs (assuming you don't enable interrupt on WDT timeout, if so it will be delayed by 2 more 32.768 kHz clock cycles).

Related