0

Soft reboot while running circuitPython program
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Soft reboot while running circuitPython program

by Jerryy on Wed Jan 13, 2021 4:32 pm

I recently purchased a Adafruit Trinket M0 and am trying to use it with CircuitPython.
Following the example in learn.adafruit on "interacting-with-the-serial-console"
I used the MU editor to load and run the following program:

import board
import digitalio
import time
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
while True:
print("Hello, CircuitPython!")
led.value = True
time.sleep(1)
led.value = False
time.sleep(1)

The output expected at the Serial s consale is for the line "Hello, CircuitPython!" to be repeatedly displayed

However instead I see a few lines of "Hello, CircuitPython!" displayed followed by the lines:

soft reboot
Auto Reload is on Simply save file over USB to run then enter REPL to disable.

This pattern is then continuousely repeated.

Does anyone have any idea why I keep getting this "soft reboot" ? Any help greatfully appreciated.

Jerry H

Jerryy
 
Posts: 14
Joined: Thu Feb 22, 2018 9:06 pm

Re: Soft reboot while running circuitPython program

by dastels on Wed Jan 13, 2021 5:02 pm

Yes, your OS poked at something on the CIRCUITPY drive. When CircuitPython sees something change on the drive it restarts and reloads the code. This is what let's it restart when you save/copy changes to it. I know Linux does this occasionally.

You can disable it from the REPL:
Code: Select all | TOGGLE FULL SIZE
>>> import supervisor
>>> supervisor.disable_autoreload()


You will have to manually restart CircuitPython when you update code, however, by using CTRL_D. You can re-enable autoreload in a similar fashion:
Code: Select all | TOGGLE FULL SIZE
>>> import supervisor
>>> supervisor.enable_autoreload()


Dave

dastels
 
Posts: 4850
Joined: Tue Oct 20, 2015 3:22 pm

Re: Soft reboot while running circuitPython program

by Jerryy on Wed Jan 13, 2021 6:13 pm

1. I'm new to CircuitPython. Where do I type the commands
import supervisor
supervisor.disable_autoreload()

in other words how do I get to the >>> prompt

2. Same question about pressing CTRL_D

You will have to manually restart CircuitPython when you update code, however, by using CTRL_D

Jerryy
 
Posts: 14
Joined: Thu Feb 22, 2018 9:06 pm

Re: Soft reboot while running circuitPython program

by dastels on Wed Jan 13, 2021 7:08 pm


dastels
 
Posts: 4850
Joined: Tue Oct 20, 2015 3:22 pm

Re: Soft reboot while running circuitPython program

by Jerryy on Wed Jan 13, 2021 7:27 pm

I did a little more reading about REPL and I know better understand
your answer and the program is working as expected.
Thanks for the help.

Jerry H

Jerryy
 
Posts: 14
Joined: Thu Feb 22, 2018 9:06 pm

Please be positive and constructive with your questions and comments.