Unit keep rebooting after running an imported function

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
MicroNinja
Posts: 16
Joined: Sun Dec 29, 2019 8:38 am

Unit keep rebooting after running an imported function

Post by MicroNinja » Fri Apr 10, 2020 8:37 am

Hi!

Keep running into odd issues it seem..
I have written a small util.py file that only include a function to connect to network

Code: Select all

import network

def wifi_connect():
    """Connect to the configured Wi-Fi network."""
    sta_if = network.WLAN(network.STA_IF)
    if not sta_if.isconnected():
        print('connecting to network...')
        sta_if.active(True)
        sta_if.connect(CONFIG['WIFI_NAME'], CONFIG['WIFI_PWD'])
        while not sta_if.isconnected():
            time.sleep(1)
    print('network config:', sta_if.ifconfig())
I execute it in the repl and it first connect succesfully. But then something hangs and it the repl hang and appear to restart/become unresponsive to any typing. I manage to caputre a flashing screen Image
This keep happen also if I disconnect from the computer.
I have to re-flash the unit to get it working again.... I dont have any main.py on the unit that execute anyhting.

Am I doing something wrong or what is causing this?

MicroNinja
Posts: 16
Joined: Sun Dec 29, 2019 8:38 am

Re: Unit keep rebooting after running an imported function

Post by MicroNinja » Mon Apr 13, 2020 8:00 pm

I soldered a second wemos and tried to upload again. The result was exactly the same.

Sometime when I use ampy to put file on it I get

Code: Select all

ampy.pyboard.PyboardError: could not enter raw repl
If I abort and try again it works again and I can see the file on the wemos. But when I enter the repl through putty then I can no longer type. It does not register and every now and then the repl seem to restart.

Must be ampy there is something wrong with??? What tool do you use to work with micropython repl on a windows machine? I want to try something else to see if that works better because now am not even leaving ground :(

This is how the repl look like when I go to it with putty. Weird signs on top of it and no typing get registered

Image

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Unit keep rebooting after running an imported function

Post by jimmo » Tue Apr 14, 2020 4:09 am

I use miniterm.py on Linux, but it's part of the pyserial library, so it should work on Windows. And pyboard.py to access the device filesystem. http://docs.micropython.org/en/latest/r ... rd.py.html

The crashing while connecting to WiFi issue is often a sign of power supply problems.

Post Reply