connect 2 wipy2.0 by WiFi
-
I try to connect two WiPy2 by WiFi
one WiFi is in AP mode (default settings)
second is in STA and try to connect to first
but i can not connect and every few seconds i got entry - what this is?n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0
i have in loop:
while not wlan.isconnected(): machine.idle()
the whole session:
wifi_sta mode : sta(24:0a:c4:00:a8:be) livius wipy-wlan-6ec2 vnet-509F64 UPC0838976 UPC Wi-Free TP-LINK_9A6D1E keke 2.4G-vnet-1C0A58 UPC8578324 DIRECT-y6-BRAVIA UPC0040392 UPC Wi-Free UPC1387285 UPC Wi-Free n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 state: 5 -> 0 (2) n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 state: 5 -> 0 (2) n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 state: 5 -> 0 (2) n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 state: 5 -> 0 (2) n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 state: 5 -> 0 (2) n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 state: 5 -> 0 (2) n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 state: 5 -> 0 (2) n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 state: 5 -> 0 (2) n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 state: 5 -> 0 (2) n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 state: 5 -> 0 (2) n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0 ``
-
this is amazing that this was so simple like wrong password from some old documentation :)
connected two wipy2 togetherrst: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:812 ho 0 tail 12 room 4 load:0x40078000,len:3692 load:0x4009f000,len:944 entry 0x4009f1f0 tcpip_task_hdlxxx : 3ffedcb0, prio:18,stack:2048 I (1843) wifi: frc2_timer_task_hdl:3ffef8a8, prio:22, stack:2048 I (1849) wifi: pp_task_hdl : 3fff2170, prio:23, stack:8192 I (2825) wifi: mode : softAP (24:0a:c4:00:a8:bf) dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1) wifi_sta I (3008) wifi: mode : sta (24:0a:c4:00:a8:be) wipy-wlan-6ec2 UPC0838976 UPC Wi-Free vnet-509F64 TP-LINK_9A6D1E 2.4G-Vectra-WiFi-B7C11C 2.4G-vnet-1C0A58 UPC Wi-Free keke UPC1387285 vnet-EC0D8E UPC Wi-Free UPC8578324 DIRECT-y6-BRAVIA STAWIK iNTERNET UPC Wi-Free I (6100) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (7074) wifi: state: init -> auth (b0) I (7077) wifi: state: auth -> assoc (0) I (7086) wifi: state: assoc -> run (10) I (7101) wifi: connected with wipy-wlan-6ec2, channel 6 WLAN connection succeeded! MicroPython v1.8.6-251-g2fb950d on 2016-12-16; WiPy with ESP32 Type "help()" for more information. >>> Connected to AP wipy-wlan-6ec2 channel 6I (17086) wifi: pm open, type:0, st: 0, sending null data: 0
-
with newest firmware still the same :(
>>> os.uname() (sysname='WiPy', nodename='WiPy', release='1.0.0.b1', version='v1.8.6-251-g2fb950d on 2016-12-16', machine='WiPy with ESP32')
rst:0x10 (RTCWDT_RTC_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:812 ho 0 tail 12 room 4 load:0x40078000,len:3692 load:0x4009f000,len:944 entry 0x4009f1f0 tcpip_task_hdlxxx : 3ffedb2c, prio:18,stack:2048 I (2440) wifi: frc2_timer_task_hdl:3ffef74c, prio:22, stack:2048 I (2451) wifi: pp_task_hdl : 3fff20c8, prio:23, stack:8192 I (3427) wifi: mode : softAP (24:0a:c4:00:a8:bf) dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1) wifi_sta I (3613) wifi: mode : sta (24:0a:c4:00:a8:be) vnet-509F64 wipy-wlan-6ec2 SoftAP-9F UPC0838976 UPC Wi-Free 2.4G-vnet-1C0A58 TP-LINK_9A6D1E keke UPC Wi-Free 2.4G-Vectra-WiFi-B7C11C DIRECT-y6-BRAVIA UPC0040392 UPC Wi-Free vnet-EC0D8E I (7001) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (7977) wifi: state: init -> auth (b0) I (7983) wifi: state: auth -> assoc (0) I (7989) wifi: state: assoc -> run (10) I (17989) wifi: state: run -> init (2) I (17990) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (18111) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (18111) wifi: state: init -> auth (b0) I (18113) wifi: state: auth -> assoc (0) I (18128) wifi: state: assoc -> run (10) I (28128) wifi: state: run -> init (2) I (28129) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (28250) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (28250) wifi: state: init -> auth (b0) I (28255) wifi: state: auth -> assoc (0) I (28269) wifi: state: assoc -> run (10) I (38269) wifi: state: run -> init (2) I (38270) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (38391) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (38392) wifi: state: init -> auth (b0) I (38396) wifi: state: auth -> assoc (0) I (38404) wifi: state: assoc -> run (10) I (48404) wifi: state: run -> init (2) I (48404) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (48526) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (48526) wifi: state: init -> auth (b0) I (48528) wifi: state: auth -> assoc (0) I (48545) wifi: state: assoc -> run (10) I (58546) wifi: state: run -> init (2) I (58546) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (58667) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (58668) wifi: state: init -> auth (b0) I (58673) wifi: state: auth -> assoc (0) I (58677) wifi: state: assoc -> run (10) I (68677) wifi: state: run -> init (2) I (68678) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (68799) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (68800) wifi: state: init -> auth (b0) I (68802) wifi: state: auth -> assoc (0) I (68808) wifi: state: assoc -> run (10) I (78809) wifi: state: run -> init (2) I (78809) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (78930) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (78931) wifi: state: init -> auth (b0) I (78934) wifi: state: auth -> assoc (0) I (78939) wifi: state: assoc -> run (10) I (88940) wifi: state: run -> init (2) I (88940) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (89061) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (89062) wifi: state: init -> auth (b0) I (89065) wifi: state: auth -> assoc (0) I (89074) wifi: state: assoc -> run (10)
-
@livius, thanks for your status update. We're still looking into this issue. I'll come back at you when I get more information.
-
this is what i got when i added sleep_ms(100) between every commands
maybe this is much more informative (file name - wdev.c)rst:0x10 (RTCWDT_RTC_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:812 ho 0 tail 12 room 4 load:0x40078000,len:3692 load:0x4009f000,len:944 entry 0x4009f1f0 rtc v134 Oct 20 2016 12:36:18 XTAL 40M I (858) phy: phy_version: 246, Nov 18 2016, 17:30:07, 0, 0 tcpip_task_hdlxxx : 3ffdf30c, prio:18,stack:2048 frc2_timer_task_hdl:3ffdfe14, prio:22, stack:2048 I (1005) wifi: pp_task_hdl : 3ffeb6cc, prio:23, stack:8192 wdev.c 1327
and wipy
hang totally
but after manual restart same info as before:I (67836) wifi: state: 5 -> 0 (2) I (67836) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (67957) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (67958) wifi: state: 0 -> 2 (b0) I (67962) wifi: state: 2 -> 3 (0) I (67998) wifi: state: 3 -> 5 (10)
-
with newest firmware 9.7 same
UPC1334070 I (6398) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (7374) wifi: state: 0 -> 2 (b0) I (7376) wifi: state: 2 -> 3 (0) I (7380) wifi: state: 3 -> 5 (10) I (17381) wifi: state: 5 -> 0 (2) I (17381) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (17502) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (17503) wifi: state: 0 -> 2 (b0) I (17504) wifi: state: 2 -> 3 (0) I (17507) wifi: state: 3 -> 5 (10) I (27508) wifi: state: 5 -> 0 (2)
and this is on WiPy in AP mode
I (1018844) wifi: station: 24:0a:c4:00:a8:be leave, AID = 1 I (1018844) wifi: n:6 1, o:6 1, ap:6 1, sta:255 255, prof:6 I (1018982) wifi: n:6 1, o:6 1, ap:6 1, sta:255 255, prof:6 I (1018982) wifi: station: 24:0a:c4:00:a8:be join, AID = 1, n, 40U I (1028985) wifi: station: 24:0a:c4:00:a8:be leave, AID = 1 I (1028986) wifi: n:6 1, o:6 1, ap:6 1, sta:255 255, prof:6 I (1029109) wifi: n:6 1, o:6 1, ap:6 1, sta:255 255, prof:6 I (1029109) wifi: station: 24:0a:c4:00:a8:be join, AID = 1, n, 40U
-
the files are:
http://konwertuj.com/content/main.py.txt
http://konwertuj.com/content/boot.py.txt
http://konwertuj.com/content/wifi_sta.py.txt
http://konwertuj.com/content/wifi_ap.py.txtremove
.txt
extension after download
-
@livius, I've been caught in several things but I didn't forget you. If you can place your code in pastebin and pass the link, that will let us reproduce it perfectly ;)
-
i can provide you my files
if you will be unable to reproduce issue
-
@livius, ok, at least we know you get similar results to me. Let me try again to reproduce yours. Thanks a lot for your feedback.
-
testet from REPL - result are near to positive
>>> import os >>> os.uname() (sysname='WiPy', nodename='WiPy', release='0.9.6.b1', version='v1.8.6-40-gd10463e on 2016-11-25', machine='WiPy with ESP32') >>> from network import WLAN >>> wlan = WLAN(mode=WLAN.STA) mode : sta(24:0a:c4:00:a8:be) >>> nets = wlan.scan() >>> print(str(nets)) [(ssid='UPC0838976', bssid=b'\x8c\x04\xff\xf5\xae\x8a', sec=4, channel=1, rssi=-42), (ssid='wipy-wlan-6ec2', bssid=b'$\n\xc4\x00n\xc3', sec=3, channel=6, rssi=-42), (ssid='UPC Wi-Free', bssid=b'\x8e\x04\xff\xf5\xae\x8c', sec=5, channel=1, rssi=-44), (ssid='vnet-509F64', bssid=b'pT\xd2b\xc4\xda', sec=4, channel=11, rssi=-49), (ssid='livius', bssid=b'\x000O\x8b\x0c\x08', sec=4, channel=9, rssi=-50), (ssid='2.4G-Vectra-WiFi-B7C11C', bssid=b'\x84\x00- <', sec=4, channel=1, rssi=-65), (ssid='2.4G-vnet-1C0A58', bssid=b't\x85*3 \xd7', sec=4, channel=1, rssi=-75), (ssid='UPC1387285', bssid=b'\x8c\x04\xff{bL', sec=4, channel=1, rssi=-79), (ssid='UPC Wi-Free', bssid=b'\x8e\x04\xff{bN', sec=5, channel=1, rssi=-80), (ssid='TP-LINK_9A6D1E', bssid=b'\xb0Hz\x9am\x1e', sec=3, channel=1, rssi=-80), (ssid='keke', bssid=b'\xb0Hz\xbe\xf6\xa4', sec=3, channel=4, rssi=-84), (ssid='Misza', bssid=b'\x00\x1d~\x91]\x07', sec=3, channel=6, rssi=-88), (ssid='vnet-A6EA06', bssid=b'\x0cT\xa5E*\xc9', sec=4, channel=11, rssi=-88), (ssid='vnet-EC0D8E', bssid=b'T\xbe\xf7\nEN', sec=4, channel=11, rssi=-88), (ssid='UPC Wi-Free', bssid=b'\x02&$>\xaa\x9b', sec=5, channel=7, rssi=-90)] >>> wlan.connect(ssid='wipy-wlan-6ec2', auth=(WLAN.WPA2, 'www.pycom.io')) >>> I (283825) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (284800) wifi: state: 0 -> 2 (b0) I (284804) wifi: state: 2 -> 3 (0) I (284820) wifi: state: 3 -> 5 (10) I (284836) wifi: connected with wipy-wlan-6ec2, channel 6 wlan.isconnected() True >>>
but here we have different timings between commands - in real script i have not pauses between commands as i have b etween typing by REPL
and as you can see above there is same but only once response with lines:
>>> I (283825) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (284800) wifi: state: 0 -> 2 (b0) I (284804) wifi: state: 2 -> 3 (0) I (284820) wifi: state: 3 -> 5 (10)
-
@livius, I tried something similar to your setup, and wasn't able to reproduce it. Using two LoPys (internally just a WiPy with the LoRa radio attached), I proceed to connect over serial port to both. Did this in one of them over the REPL:
from network import WLAN wlan = WLAN(mode=WLAN.STA) nets = wlan.scan() # just to get a list print(str(nets)) wlan.connect(ssid='lopy-wlan-be54', auth=(WLAN.WPA2, 'www.pycom.io')) # put your ssid here # waited for a few seconds (counted to 10) wlan.isconnected() # this printed true
That's the most trivial test I could run. To rule out some possible causes, I want to ask you to try the same, using your own ssid, over serial REPL, and come back with the results to me.
PS: I also tried the version with the loop, and it worked the way it's supposed
-
@livius. I'm going to run some tests later and come back to you with a result.
-
Any help? Can someone successfully connect two Wipy 2 together?
-
with firmware 9.6
it repeat
I (36355) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (36476) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (36476) wifi: state: 0 -> 2 (b0) I (36479) wifi: state: 2 -> 3 (0) I (36487) wifi: state: 3 -> 5 (10)
ets Jun 8 2016 00:22:57 rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) ets Jun 8 2016 00:22:57 rst:0x10 (RTCWDT_RTC_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:812 ho 0 tail 12 room 4 load:0x40078000,len:3692 load:0x4009f000,len:944 entry 0x4009f1f0 rtc v134 Oct 20 2016 12:36:18 XTAL 40M I (824) phy: phy_version: 246, Nov 18 2016, 17:30:07, 0, 0 tcpip_task_hdlxxx : 3ffdef94, prio:18,stack:2048 frc2_timer_task_hdl:3ffdfa9c, prio:22, stack:2048 I (968) wifi: pp_task_hdl : 3ffdfc68, prio:23, stack:8192 mode : softAP(24:0a:c4:00:a8:bf) dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1) wifi_sta mode : sta(24:0a:c4:00:a8:be) livius wipy-wlan-6ec2 SoftAP-9F vnet-509F64 UPC0838976 UPC Wi-Free 2.4G-Vectra-WiFi-B7C11C TP-LINK_9A6D1E UPC Wi-Free 2.4G-vnet-1C0A58 keke DIRECT-y6-BRAVIA UPC Wi-Free UPC0040392 I (5100) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (6076) wifi: state: 0 -> 2 (b0) I (6077) wifi: state: 2 -> 3 (0) I (6081) wifi: state: 3 -> 5 (10) I (16081) wifi: state: 5 -> 0 (2) I (16081) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (16202) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (16203) wifi: state: 0 -> 2 (b0) I (16207) wifi: state: 2 -> 3 (0) I (16212) wifi: state: 3 -> 5 (10) I (26212) wifi: state: 5 -> 0 (2) I (26213) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (26334) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (26334) wifi: state: 0 -> 2 (b0) I (26338) wifi: state: 2 -> 3 (0) I (26354) wifi: state: 3 -> 5 (10) I (36354) wifi: state: 5 -> 0 (2) I (36355) wifi: n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 I (36476) wifi: n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 I (36476) wifi: state: 0 -> 2 (b0) I (36479) wifi: state: 2 -> 3 (0) I (36487) wifi: state: 3 -> 5 (10)
this is my code - in file 'wifi_sta.py' and i execute it from boot.py as
execfile('wifi_sta.py')
:import pycom import machine from network import WLAN print('wifi_sta') pycom.heartbeat(0) pycom.heartbeat(1) pycom.rgbled(0x00ff00) wlan = WLAN(mode=WLAN.STA) nets = wlan.scan() for net in nets: print(str(net.ssid)) if not wlan.isconnected(): #wlan.ifconfig(config=('192.168.4.2', '255.255.255.0', '192.168.4.1', '192.168.4.1')) #wlan.connect('wipy-wlan-a8be', auth=(WLAN.WPA2, 'www.wipy.io'), timeout=5000) wlan.connect('wipy-wlan-6ec2', auth=(WLAN.WPA2, 'www.wipy.io'), timeout=5000) while not wlan.isconnected(): machine.idle() # save power while waiting print('WLAN connection succeeded!') pycom.heartbeat(0) pycom.heartbeat(1) pycom.rgbled(0x00ff00)
also if you uncomment line
wlan.ifconfig(config=('192.168.4.2', '255.255.255.0', '192.168.4.1', '192.168.4.1'))
and also if i change
while not wlan.isconnected(): machine.idle()
to
pass
time.sleep_ms(10)
-
I have not access to my home WiPy now
but there is really simple code - i write it from my memory:First WiPy. in STA mode
wlan = WLAN(mode=WLAN.STA) nets = wlan.scan() print(str(nets)) wlan.connect(ssid='wipy-xxxx-a8', auth=(WLAN.WPA2, 'www.pycom.io')) while not wlan.isconnected(): machine.idle() print('connected')
Second WiPy run in default AP mode without modification
and i never got 'connected' message
only output like:n:6 0, o:6 1, ap:255 255, sta:6 1, prof:6 n:6 1, o:6 0, ap:255 255, sta:6 1, prof:6 state: 0 -> 2 (b0) state: 2 -> 3 (0) state: 3 -> 5 (10) add 0
all with recent software 0.9.5
-
Hello,
Can you share the code that you are using to try this? Thanks.
Cheers,
Daniel