OSError: no available NIC after Soft-Reset

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
zmaier
Posts: 1
Joined: Thu May 16, 2019 12:44 pm

OSError: no available NIC after Soft-Reset

Post by zmaier » Thu May 16, 2019 12:47 pm

Hello,

i have a problem, hopefully you can help me.
After a soft-reset (CTRL-D in REPL), i get the error that there is no available NIC when using the urequest.post command. After a hard-reset everything is working fine.
Propably the re-initialization of the wifi interface is not done right, but the telnet-Repl is still alive?

boot.py:
import machine
import os
from network import WLAN
import time
import pycom
import urequests

uart = machine.UART(0, baudrate=115200)
os.dupterm(uart)

wlan = WLAN()

if machine.reset_cause() != machine.SOFT_RESET:
wlan.mode(WLAN.STA)
if wlan.isconnected():
print('Already connected to WiFi network.')
else:
wlan.connect(net_to_use.ssid, auth=(net_to_use.sec, pw), timeout=10000)
while not wlan.isconnected():
time.sleep_ms(500)
print('.', end='')
print(' connected.')
machine.main('main.py')

main.py:
while true:
payload="status,volk={0} wert={1:0.2f} {2}".format(Volk_Nummer,Status,t)
response = urequests.post(db, data=payload)
time.sleep(20

Post Reply