Hw reset and/or reboot?

I could not find any explanation of how to do hardware reset of the camera, effectively making it reboot.

Is it as simple as grounding the RST pin?

If so, what is the BOOT pin for, then, what’s the difference?


Yes, just ground the RST pin. The BOOT pin controls if the default STM DFU bootloader turns on. The STM bootloader allows you to get out of being bricked if the flash gets completely corrupted.

Let me see if I understand this. Since the OpenMV board doesn’t have a physical RST button like the Pyboard so do I need to ground the RST pin to trigger a hard reset?


You can also do either of the following:

import machine


import pyb

Hum! It’s good to know that one can also trigger a hard reset via command prompt. Thanks for that info.

I have a main.py that imports another file from the sd card (import sensor) and everytime I made changes to the sensor.py file in my local laptop, I have to copy it into the sd card and do a hard reset so the main.py can pick up the latest changes. Is this the normal behavior? It seems that files loaded by main, are loaded only once and stay in the memory.

“sensor” is a built-in module we use… not sure if you should be shadowing that. Maybe rename that file?

As for the requirement of reset behavior. That’s a deeper issue into how MP works. I can’t tell you that exactly from my knowledge. Could be a bug with the system, or not. Maybe Ibrahim knows more.

I used sensor.py to simplify things. We do use a different name. It seems that is how MP work. Loads imported modules and cache them in memory, which forces you to hard reset the board if you need test new changes in those modules.

Mmm, okay, well, you should at least be able to use the IDE to update the main script easily.

I noticed that Control-D looks like it does a soft-reset, but doesn’t. The heap doesn’t get reinitialized and everything seems to still be in memory.

If you create a simple module (say bar.py) with just a single line:


and you try and import it twice, then you’ll notice that the second time it doesn’t do anything because the module is already loaded.

>>> import bar
>>> import bar

By deleting the module from sys.modules then you can make import reload it:

>>> import sys
>>> import bar
>>> import bar
>>> del sys.modules['bar']
>>> import bar

The only downside to this, is that you now have a reference to the new module. If some other module imported bar, it would still have a reference to the old module. Which is one reason I really like the soft-reset functionality on the pyboard. I’d really like to see that on the openmv, but there may be a reason its not implemented.

You can create a function called reload:

def reload(mod):
    import sys
    mod_name = mod.__name__
    del sys.modules[mod_name]
    return __import__(mod_name)

in say your boot.py or main.py and then do:

>>> import bar
>>> reload(bar)
<module 'bar' from 'bar.py'>

Mmm, put a bug on it in the openmv repo.

Fixed, initially I just didn’t think REPL will be used that much with the IDE.

I like to use rshell to copy files onto and off of my MicroPython boards, and it relies on pyboard.py which also relies on Control-D doing a soft-reset actually working.

Does any way to shutdown a board, without wirinig grnd and rst pin or booting?

MCUs don’t have a shutdown command. They can be reset or out to sleep. But, there is no such thing as a power off. You can put it to sleep in firmware or you can cut the power to the board.