Exp Board 2.0 serial communication problem



  • Hello,

    I have to FiPy modules with two Exp Boards 2.0. One of them (V.3.0r mark at the bootm) works fine but the second (v2.1) doesn't, i can't reach the arrows (>>>) and it stack during connection.
    Just day before yesterday it was working. Also the update doesn't work. Its not FiPy isse because when put this to my first board I can update this , upload code etc. Also its visible for operating system. LINUX /dev/ttyUSB0 Windows 10 as COM 5. I've bought this in Farnell, should I return this ? or maybe its something with FTDI chip ? I remeber that few years ago when i was using Rs485-USB converter I had to install the update from FTDI side?



  • @szyba91 What do you mean with: does not work? The copying or the script?
    For copying Filezilla also support a upload option with the right cick on the file. SImple Double-Click also copies. Did you set the number of transfers to 1 in the settings? The ftp server in the xxPy devices is pretty limited.
    I had never problems using ftp for file transfer, but I'm using FireFTP, which is a Firefox plugin. That is convenient because I have firefox open anyhow almost all the time.



  • @robert-hh said in Exp Board 2.0 serial communication problem:

    @szyba91 You can drag files between the two panes. Just maneuver on the left pane to your project directory and move files to the right side. Source files can be placed in /flash or /flash/lib, to be found by the import statement. Within the filezilla settings, section "modify files" (or so) you can define your favorite editor. If then in a file pane, right click, you chose view/edit, you can directly edit the file.
    Edit: it is important that in the setting you have set passive mode/1 connection only. It is also convenient to add your device to the server list under file->server manager
    Edit2: You can create bookmarks in Filezilla, which include directory settings and device connections.
    Edit 3: If you are by chance a Firefox user, you might like FireFTP as ftp client, which in my opinion is easier to use than FileZilla. There is no similar too for Google Chrome.

    OK.I've dragged files form computer(defult left window) to flah -> lib (default right side).
    First I've do so with simple RGB led and it works and i was also able to see REPL prompt .

    I thought myself "yes finally I go further with IoT project". So - again I uploded simple LoRa raw ping code between A and B device and.... doesn't work :(
    Maybe i will create another subject? This one is actaully solvde becasue with Your help i was able to fix communication problem - now it seams that this is different kid of problem.



  • @szyba91 You can drag files between the two panes. Just maneuver on the left pane to your project directory and move files to the right side. Source files can be placed in /flash or /flash/lib, to be found by the import statement. Within the filezilla settings, section "modify files" (or so) you can define your favorite editor. If then in a file pane, right click, you chose view/edit, you can directly edit the file.
    Edit: it is important that in the setting you have set passive mode/1 connection only. It is also convenient to add your device to the server list under file->server manager
    Edit2: You can create bookmarks in Filezilla, which include directory settings and device connections.
    Edit 3: If you are by chance a Firefox user, you might like FireFTP as ftp client, which in my opinion is easier to use than FileZilla. There is no similar too for Google Chrome.



  • @robert-hh Looks like i had to reset program Filezilla. Now I'm finlly connted via FTP.

    0_1534343234240_resut.png

    Could you explain me how to upload the code via FTP ?



  • @szyba91 Please follow the instructions from the documentation: https://docs.pycom.io/chapter/gettingstarted/programming/FTP.html



  • @robert-hh Ok - using the wlan.ifconfig() if got this:
    ('192.168.0.14', '255.255.255.0', '192.168.0.1', '37.8.214.2')

    So 192.168.0.14 is the IP that i have to write to FilleZilla configrator?
    I've already do so and there is a progress beacuse i have following serwer answer

    Status: Connecting to 192.168.0.14:21...
    Status: Connection established, waiting for welcome message...
    Status: Initializing TLS...
    Error: GnuTLS error -15: An unexpected TLS packet was received.
    Error: Could not connect to server
    Status: Waiting to retry...
    Status: Connecting to 192.168.0.14:21...
    Status: Connection established, waiting for welcome message...
    Response: 220 Micropython FTP Server
    Command: AUTH TLS
    Response: 332
    Status: Initializing TLS...
    Error: GnuTLS error -15: An unexpected TLS packet was received.
    Error: Could not connect to server



  • @szyba91 Then you should be able to connect. The ip address of the FiPy is shown with:
    wlan.ifconfig()
    (maybe it's wlan.ifconfig(id=0))



  • @robert-hh Result of wlan.isconnected() is "True"



  • @szyba91 Then WPA2 is OK. No. Do not change the commands. wlan.isconnected() just checks, whether a connection exists. Making the connection can sometimes take some time, longer than the 5 seconds. You may also just issue the command
    wlan.connect('vnet-47DA1E', auth=(WLAN.WPA2, '89050914123'))
    and then after some time check with wlan.isconnected(), whether the connection was made.



  • @robert-hh Its WPA2 Personal (I've read this from WIndows netowrk properties) Should I change it ?

    As for redo: You mean instead of using wlan.connect('vnet-47DA1E', auth=(WLAN.WPA2, '89050914123'), timeout=5000)

    use this : wlan.isconnected() ?



  • @szyba91 You need the quotes. Did you get any errors with the commands? What happens if you redo the wlan.isconnected() later?
    I assumed the security sertting of your network is WPA2. It may be different.



  • @robert-hh I'm trying to use enter your second idea with manuall cammands. Res Result : WLAN connected: False

    I've change the myssid to my real network ssid and same with key. I've try with quotes and without quotes and its the same.



  • @robert-hh Sorry, the AP password is "www.wipy.io"



  • @szyba91 For connecting via FTP, you have also to connect "the WLAN wire", meaning, your PC has either to attach to the access point created by the FiPy, or the FiPy has to join the WIfI network you are using with the PC.
    By default, the FiPy creates an Access point with the name <forgot the name> and the password "micropythoN". When you attach to that, the FiPy assignes an IP address to your PC and is itself available with the IP address 192.168.4.1. You can then ftp to that address.
    For the FiPy to acess your WiFi network it requires a short script in your FiPy's boot.py or main.py. This is from the examples & should work.

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

    The trick is to get that into the device. You can enter them manually into the REPL prompt. The required statements are:

    from network import WLAN
    wlan = WLAN(mode=WLAN.STA)
    wlan.connect('myssid', auth=(WLAN.WPA2, 'mywifikey'), timeout=5000)
    print("WLAN connected: ", wlan.isconnected())
    


  • @robert-hh Could you provide me some information about your tools to programe fipy? What I've know you have Filezilla and using FTP serever and simple terminal like PuTTY aslo.

    Is there any manual how set up this step by step ? I've been trying to folow the PyCom doucumentation but When i try to connect to 192.168.4.1 is unreachable.

    How can i uplode the code in your way without using Atom or VSCode ?



  • @szyba91 That depends on what is in the main.py you just uploaded. And if you upload with ftp, the REPL prompt stays until evetually you reset the device, at whih time the normal sequance is executed (see below).
    Since I do not know what Pymakr/VSC does, it may lock the device or force a safe boot, such that it requires a hard reset to run again with the intended sequence.



  • @robert-hh said in Exp Board 2.0 serial communication problem:

    During boot, roughly the following steps are executed.

    But it isn't normal that after uploading code I can't reach REPL prompt ? Because its happnes.



  • @szyba91 When you upload code in main.py that will run infinitely, you will not get a REPL prompt. This prompt will be presented AFTER main.py is finished.
    Edit: During boot, roughly the following steps are executed.

    1. Initialize the device
    2. Run _boot.py from frozen bytecode
    3. Run _main.py from frozen bytecode
    4. Run /flash/boot.py from the filesystem
    5. Run /flash/main.py from the filesystem
    6. Start REPL and show it's prompt.


  • @robert-hh I've noticed that FiPy is getting stack when I'm uploading code. Now i uploaded the simple RGB led blink and I can see the result but it is also stucking:
    rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff8028,len:8
    load:0x3fff8030,len:1728
    load:0x4009fa00,len:0
    load:0x4009fa00,len:14584
    entry 0x400a059c

    After last command I can't see the REPL, firmer update helps but it seams that code had been uploded correctly.


 

Pycom on Twitter