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

    machine.SOFT_RESET

    Scheduled Pinned Locked Moved LoPy
    9 Posts 4 Posters 2.8k Views 4 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.
    • R Offline
      robotmad
      last edited by

      LoPy updated to 0.9.0.b2
      Following the tutorial for WLAN (section 3.2)
      [https://docs.pycom.io/lopy/lopy/tutorial/wlan.html]
      I an getting an error
      AttributeError: 'module' object has no attribute 'SOFT_RESET'

      1 Reply Last reply Reply Quote 0
      • R Offline
        robotmad
        last edited by

        Investigating I see that after a soft reset (Ctrl-D) reset_cause() still reports 'None'.

        Further:
        wlan.init(WLAN.STA)
        gives an error:
        TypeError: extra positional arguments given

        Although initialising
        wlan =WLAN(mode=WLAN.STA)
        works OK.

        1 Reply Last reply Reply Quote 0
        • ? Offline
          A Former User
          last edited by

          Hi robotmad,
          Great to hear that you found a solution. Indeed there is a mistake in the example.
          It should be like here: https://docs.pycom.io/wipy/library/network.html?highlight=wlan.init#network.wlan.init
          We will fix example code.
          Reset cause function not jet implemented on LoPy board. We working on that.

          K 1 Reply Last reply Reply Quote 0
          • R Offline
            robotmad
            last edited by

            More observations...

            • Expansion board manual shows use of "GP" values for identifying the IO pins e.g. "GP16", but you actually seem to have to
            • pushbutton on G17, even when set as an input (with a PULL_UP) this pin appears to be driven low (not a fault on the expansion board), so the pushbutton input doesn't work.
            • the heartbeat LED won't show any colour other than Blue.
            • I've not found any means to control timing given the absence of the Timer class - e.g. to get a LoRa node to send a message once every XXX seconds?
            • It is easy to get a crash with LoRa things being in a tight loop (hence the need for some means to control timing):
              /home/danicampora/Code/pycom/esp-idf-new/components/freertos/./queue.c:1326 (xQueueGenericReceive)- assert failed!
              Guru Meditation Error: Core 0 panic'ed.

            Please can we have more documentation e.g.

            • What does the parameter to the LoRa socket recv function do?
            1 Reply Last reply Reply Quote 1
            • K Offline
              kurt @Guest
              last edited by

              @Maris said in machine.SOFT_RESET:

              https://docs.pycom.io/wipy/library/network.html?highlight=wlan.init#network.wlan.init

              Sorry, I don't get it. What is it to be done instead of checking for machine.SOFT_RESET? Or has the documentation in https://docs.pycom.io/wipy/library/network.html?highlight=wlan.init#network.wlan.init changed again?

              Cheers, Kurt.

              1 Reply Last reply Reply Quote 0
              • ? Offline
                A Former User
                last edited by

                @kurt We try to constantly fix mistakes in documentation, so time by time documents get updated.

                Please use code from WiFi example https://docs.pycom.io/lopy/lopy/quickref.html#wlan-wifi

                1 Reply Last reply Reply Quote 0
                • K Offline
                  kurt
                  last edited by

                  @Maris I appreciate your work to improve the documentation and your quick response.

                  I tried the code you suggested:

                  from network import WLAN
                  
                  # configure the WLAN subsystem in station mode (the default is AP)
                  wlan = WLAN(mode=WLAN.STA)
                  # go for fixed IP settings
                  wlan.ifconfig(config=('192.168.2.5', '255.255.255.0', '192.168.2.1', '8.8.8.8'))
                  #wlan.ifconfig(config='dhcp') # trying dhcp
                  wlan.scan()     # scan for available networks
                  wlan.connect('my-ssid', auth=(WLAN.WPA2, 'my-password'), timeout=5000)
                  for i in range(10):
                      if wlan.isconnected():
                          break
                  print(wlan.ifconfig())
                  

                  When I check wlan.ifconfig() it prints ('192.168.2.5', '255.255.255.0', '192.168.2.1', '0.0.0.0'). The DNS address is set to 0!
                  Then it starts printing reconnect, repeating it endlessly, no timeout. I can stop it by issuing a wlan.disconnect().

                  The whole reset sequence using the code above looks like this:

                  rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
                  configsip: 0, SPIWP:0x00
                  clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
                  mode:QIO, clock div:2
                  load:0x3fff9010,len:8
                  load:0x3fff9018,len:312
                  load:0x40078000,len:2352
                  load:0x4009f000,len:1196
                  entry 0x4009f2d8
                  frc2_timer_task_hdl:3ffd2704, prio:22, stack:2048
                  tcpip_task_hdlxxx : 3ffd7224, prio:18,stack:2048
                  pp_task_hdl : 3ffdb494, prio:23, stack:8192
                  mode : softAP(24:0a:c4:00:11:c9)
                  dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
                  dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
                  mode : sta(24:0a:c4:00:11:c8)
                  ('192.168.2.5', '255.255.255.0', '192.168.2.1', '0.0.0.0')
                  MicroPython f5444c7 on 2016-10-12; LoPy with ESP32
                  Type "help()" for more information.
                  >>> reconnect
                  reconnect
                  reconnect
                  reconnect
                  ...
                  

                  Any idea?

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    daniel
                    last edited by

                    Hi kurt,

                    Thanks for the report. I confirm that there's a bug on the DNS setting part. I cannot reproduce your reconnect issue yet, but I'll look into it.

                    Cheers,
                    Daniel

                    K 1 Reply Last reply Reply Quote 0
                    • K Offline
                      kurt @daniel
                      last edited by kurt

                      @daniel, I got it working using the code example that @DarkHawk posted here.
                      I only added a line wlan.ifconfig(config=('192.168.2.5', '255.255.255.0', '192.168.2.1', '8.8.8.8'))
                      before nets = plan.scan().

                      When I compare the few lines of code I cannot really see the difference. I'm not sure, but the only logical explanation would be a typo in the ssid or password. Of course I confirmed them several times...

                      Only issue left is the DNS but that you know about already.

                      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