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: 10
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:

Code: Select all

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:

Code: Select all

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
  

Lowe
Posts: 1
Joined: Wed May 29, 2019 7:13 pm

Re: OSError: no available NIC after Soft-Reset

Post by Lowe » Wed May 29, 2019 7:15 pm

zmaier wrote:
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
Facing similar issues here too. In need of help. Help is highly appreciated.

Thanks in advance,
Regards,
Lowe

___________________________________________________________________________________________________________
https://freejobalert.vip/ https://gimp.software/ https://notepad.software/
Last edited by Lowe on Fri Jun 07, 2019 6:23 pm, edited 1 time in total.

Christian Walther
Posts: 52
Joined: Fri Aug 19, 2016 11:55 am

Re: OSError: no available NIC after Soft-Reset

Post by Christian Walther » Thu May 30, 2019 11:16 am

Neither of you state what hardware you are using, so nobody can tell whether it’s something they are familiar with and could answer. You’d probably get a better chance at useful answers by posting in a board-specific forum rather than “General Discussion”.

User avatar
Roberthh
Posts: 1517
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: OSError: no available NIC after Soft-Reset

Post by Roberthh » Thu May 30, 2019 12:47 pm

@zmaier Why do you set wlan.mode() only on hard reset? It does not hurt to set it at any boot type.

zmaier
Posts: 10
Joined: Thu May 16, 2019 12:44 pm

Re: OSError: no available NIC after Soft-Reset

Post by zmaier » Fri May 31, 2019 7:00 am

I am using a WiPy 3.0.

wlan.mode(WLAN.STA) at any boot type,
I read somewhere, that the connection (telnet repl) will get lost wenn setting the wlan-mode?

User avatar
Roberthh
Posts: 1517
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: OSError: no available NIC after Soft-Reset

Post by Roberthh » Fri Jun 07, 2019 6:56 pm

So you are using the PyCom WIPy3 with the PyCom firmware? Then better ask at the PyCom forum: forum.pycom.io

Post Reply