Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    OSError: no network card available after newest firmware update

    Scheduled Pinned Locked Moved Issues & Bugs
    2 Posts 2 Posters 69 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z Offline
      Zino Henderickx
      last edited by Zino Henderickx

      Hello everyone,

      I updated my latest firmware from the Pycom Lopy 4 (v.1.20.2.r4) and since ever then I can't send data over WiFi and I also can't change from protocol because it is for a task at the University.

      This is my main code:

      from machine import Pin
      from time import sleep_ms
      import time
      import urequests
      
      btn = Pin('P16', Pin.IN, Pin.PULL_UP)
      btn2 = Pin('P17', Pin.IN, Pin.PULL_UP)
      btn3 = Pin('P18', Pin.IN, Pin.PULL_UP)
      btn4 = Pin('P19', Pin.IN, Pin.PULL_UP)
      
      led = Pin('P20', Pin.OUT, Pin.PULL_DOWN)
      
      def irq_function_sad(self):
          if not btn.value():
              led.value(1)
              print("ongelukkig")
              sleep_ms(500)
              send_sad("ongelukkig")
          else:
              led.value(0)
      
      
      def send_sad(sad):
          res = urequests.post('http://xxxxxx', json={"emotie": sad})
          res.close()
          if (res.status_code - 200) < 100: # check that response code is in the 200 range
              print('done')
          else:
              print('there was some error')
      
      
      def main():
          btn.callback(Pin.IRQ_FALLING, irq_function_sad)
          while True:
              print(btn.value())
              time.sleep(2)
      
      
      if __name__ == "__main__":
          main()
      

      My error:

      Unhandled exception in callback handler
      Traceback (most recent call last):
        File "main.py", line 18, in irq_function_sad
        File "main.py", line 24, in send_sad
        File "/flash/lib/urequests.py", line 116, in post
        File "/flash/lib/urequests.py", line 56, in request
      OSError: Network card not available
      

      Can someone help me please? Or did someone had the same problem?

      Kind regards,

      Zino

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gijs
        last edited by Gijs

        It seems you never instantiate a network. Perhaps in 1.18 you were using the pycom.wifi_on_boot (etc. from here: https://docs.pycom.io/firmwareapi/pycom/pycom/#pycomwifi_on_bootboolean) settings which might have been erased when you did the firmware update?
        In any case, you should be able to add the example from here: https://docs.pycom.io/tutorials/networks/wlan/#connecting-to-a-router to your main() to resolve the issue.

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom