Trouble Getting Started ?



  • I just got hold of a LoPy and I have been following the 'getting started' instructions here:
    https://docs.pycom.io/pycom_esp32/pycom_esp32/getstarted.html#micropython-introduction

    I got the firmware upgraded as suggested via the USB on the base board (it enumerates as COM9).
    However when open pyMakr and put in my device as COM9, micro, python on the console all I see is :

    Could not enter friendly repl. (click to attempt to reconnect)
    Connecting to a Pycom device...
    Connected
    Could not enter friendly repl. (click to attempt to reconnect)

    Also when check my available WiFi networks on the PC I don't see anything that looks like a SSID from LoPy. I have WiFi aerial plugged into the LoPy.

    If open COM9 in putty and reset the board I do see some boot messages but no '>>>>' prompt. I see this boot info in putty:

    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:248
    load:0x40078000,len:4072
    load:0x4009f000,len:940
    entry 0x4009f1ec
    tcpip_task_hdlxxx : 3ffed250, prio:18,stack:2048
    I (2354) wifi: frc2_timer_task_hdl:3fff0a98, prio:22, stack:2048
    I (2359) wifi: pp_task_hdl : 3fff3348, prio:23, stack:8192
    I (3334) wifi: sleep disable
    I (3335) wifi: mode : softAP (24:0a:c4:00:0c:61)
    dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
    I (3388) wifi: sleep enable
    I (3389) wifi: type: 1
    I (3389) wifi: mode : sta (24:0a:c4:00:0c:60)
    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:248
    load:0x40078000,len:4072
    load:0x4009f000,len:940
    entry 0x4009f1ec
    tcpip_task_hdlxxx : 3ffed2d8, prio:18,stack:2048
    I (2349) wifi: frc2_timer_task_hdl:3fff0b20, prio:22, stack:2048
    I (2354) wifi: pp_task_hdl : 3fff33d0, prio:23, stack:8192
    I (3329) wifi: sleep disable
    I (3330) wifi: mode : softAP (24:0a:c4:00:0c:61)
    dhcp server start:(ip: 192.168.4.1, mask: 255.255.255.0, gw: 192.168.4.1)
    I (3383) wifi: sleep enable
    I (3384) wifi: type: 1
    I (3384) wifi: mode : sta (24:0a:c4:00:0c:60)

    So where I am going wrong, what have I missed ???


  • administrators

    Hello @nurquhar ,

    Indeed the problem is that the person that had the LoPy before you already loaded scripts to connect to a certain LoPy network. What you need to do is to use the safe boot mode, connect via ftp and erase main.py and boot.py, then reset the board. This will cause the original main and boot files to be restored. After that please perform a firmware update using our update tool:

    https://forum.pycom.io/topic/522/new-firmware-release-1-4-0-b1

    After that follow our getting started and the WLAN step by step on the docs, which also include examples to connect the LoPy to your wireless router and be able to telnet/ftp while keeping your laptop connected to internet.

    https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/wlan.html

    It is possible to transfer the files to the board via serial using Pymakr, just by pressing the sync button.

    Cheers,
    Daniel



  • I think I have it fixed now.

    I comment out all the code in boot.py which was there to connect the AP 'ghost'. I never added this it must have been on the board already when it was given to me.

    Now when I reboot the board without the G28-3v3 link in the lopy-wlan-xxxx appears in the available networks.

    What should the default boot.py look like ?

    So I now have this :

    # NAU - 25/01/17
    from network import WLAN
    import machine
    import os
    
    uart = machine.UART(0, 115200)
    os.dupterm(uart)
    
    #wlan = WLAN(mode=WLAN.STA)
    #nets = wlan.scan()
    #for net in nets:
    #    if net.ssid == 'ghost':
    #        print('Network found!')
    #        wlan.connect(net.ssid, auth=(net.sec, 'ageofconan'), timeout=5000)
    #        while not wlan.isconnected():
    #            machine.idle() # save power while waiting
    #        print('WLAN connection succeeded!')
    #        break
    

    If I re-able the code I have commented out and change the SSID to the one my WiFi network uses will it connect ok even though I have WPA2 security ?

    Its a bit of a pain to tie up the wifi on Laptop to connect to the LoPy as I then loose my internet access unless I plug in a wired connection as well.

    Also I can use FTP to move files to/from the LoPy. Is there a way to this via the USB/Serial port instead ? I am thinking ymodem from within ExtraPutty.

    Thanks in advance.

    Regards Neil



  • @nurquhar

    I managed to get the boot.py and main.py files off the board with filezilla.

    do you mean that you delete it? if yes than this is not good.
    you can format flash by
    os.mkfs('/flash')
    this erase all from flash and create "fresh" boot.py and main.py

    and if you look into your current boot.py
    you have there
    wlan = WLAN(mode=WLAN.STA)
    this mean that you change your Wifi wif from AP(access point) to STA(client)
    in client mode you cannopt connect to WiPy and you can not see it in network list
    you can only connect your wipy to another AP e.g. home router

    and this is here
    if net.ssid == 'ghost':
    you accept ssid=ghost
    and set auth
    wlan.connect(net.ssid, auth=(net.sec, 'ageofconan'), timeout=5000)



  • Spoke to soon. When I remove the G28 link to 3.3v and reboot the LoPy disappears from the list of available WiFi networks.

    I managed to get the boot.py and main.py files off the board with filezilla.
    Boot.py has :
    from network import WLAN
    import machine
    import os

    uart = machine.UART(0, 115200)

    os.dupterm(uart)

    wlan = WLAN(mode=WLAN.STA)
    nets = wlan.scan()
    for net in nets:
    if net.ssid == 'ghost':
    print('Network found!')
    wlan.connect(net.ssid, auth=(net.sec, 'ageofconan'), timeout=5000)
    while not wlan.isconnected():
    machine.idle() # save power while waiting
    print('WLAN connection succeeded!')
    break

    So how do I get default settings to persist after removing the G28 link ?



  • The factory firmware reset seems to have worked !

    I can now connect PC Wifi to the LoPy and get the >>>> prompt with telnet.

    I guess I can now start with getting to know Python.

    Thanks for the help.



  • @nurquhar
    look here "2.5 Boot modes and safe boot"
    https://docs.pycom.io/pycom_esp32/pycom_esp32/toolsandfeatures.html

    after that connect to your board by ftp/telnet or COM and look what you have in boot.py and main.py files



  • I did not change anything, I had not reach that level of expertise yet !

    However some else had the board before me so its possible they fiddled with something. Can I do a 'factory reset' somehow ?



  • @nurquhar
    did you hanged something in boot.py or main.py?
    i ask because of this line
    I (3389) wifi: mode : sta (24:0a:c4:00:0c:60)

    it looks like you changed code to connect to router not as AP


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.