rst cause:2, boot mode:(3,6)

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
jadro
Posts: 12
Joined: Wed Apr 29, 2020 7:02 pm

rst cause:2, boot mode:(3,6)

Post by jadro » Mon Jul 06, 2020 7:52 pm

Hi,

I have Node D1 mini with Micropython firmware and python program that connects to MQTT and works couple of months without problems.

Couple of days ago i try to upgrade my application with function that checks internet. Now when I disable my wlan, It reads function and everithing goes ok but just 4 times called in main loop with no internet wifi connection. After 4 times it reset. Function is this:

Code: Select all

from gc import collect
from urequests import get
from   time import sleep

def check_internet():
  print("Checking internet...")  
  try:
    sleep(.5)
    #_ = urequests.get('https://www.google.hr')
    response = get('https://www.google.hr')
    response.close()
    print("Connected to internet")
    collect()
    return True
  except:
    collect()
    print("Not connected to internet")
    return False
These are prints from function call:

Main LOOP...


Checking internet...
Not connected to internet

Checking internet...
Not connected to internet

Checking internet...
Not connected to internet

Checking internet...

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 31088, room 16
tail 0
chksum 0x44
load 0x3ffe8000, len 1028, room 8
tail 12
chksum 0x1e
ho 0 tail 12 room 4
load 0x3ffe8410, len 824, room 12
tail 12
chksum 0x89
csum 0x89


Trying to connect...

And then connects. Somethimes it reboots couple (3 or 4) times and connects and works great...

What can I do, I have many gc.collect() in my code?

Thanx,
Jadro

jadro
Posts: 12
Joined: Wed Apr 29, 2020 7:02 pm

Re: rst cause:2, boot mode:(3,6)

Post by jadro » Wed Jul 08, 2020 3:43 pm

Solved. I just remove function for checking internet and my MQTT client code reconnects until internet connection is back.

No need to write complex and unnecessary code.

Post Reply