connect 2 wipy2.0 by WiFi



  • 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
    




  • @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


  • administrators

    Hello,

    Can you share the code that you are using to try this? Thanks.

    Cheers,
    Daniel


 

Pycom on Twitter