2

I'm looking for a method/function to be able to reset a Raspberry Pi Pico via programming, using the Pic's C SDK. Is this possible?

There is a way to do it using python using machine.reset() but I can't call that from within C (I think). I also want to avoid wiring a transistor into the ciruit. Thanks

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Oct 1, 2021 at 20:35

2 Answers 2

3

I don't see another way than using the watchdog. The example in the SDK documentation looks similar to this:

void software_reset()
{
    watchdog_enable(1, 1);
    while(1);
}

This busy waits 1ms until the chip is reset by the watchdog.

The time could be reduced to 1us by writing the value 2 directly to the watchdog LOAD register. I don't know if writing zero would lead to an immediate reset, it could also be that the counter wraps around to 0x00FFFFFF.

You could also use the scratch registers of the watchdog to detect a software reset.

1
  • The necessary include is #include "hardware/watchdog.h"
    – user85471
    Commented Jan 17, 2023 at 23:04
0

A more raw solution at the level of working with registers.

void software_reset()
{
    *((volatile uint32_t*)(PPB_BASE + 0x0ED0C)) = 0x5FA0004;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.