machine.SOFT_RESET
-
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'
-
@daniel, I got it working using the code example that @DarkHawk posted here.
I only added a linewlan.ifconfig(config=('192.168.2.5', '255.255.255.0', '192.168.2.1', '8.8.8.8'))
beforenets = 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.
-
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
-
@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 printingreconnect
, repeating it endlessly, no timeout. I can stop it by issuing awlan.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?
-
@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
-
@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.
-
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?
-
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.
-
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 givenAlthough initialising
wlan =WLAN(mode=WLAN.STA)
works OK.