FTPconnection not working if wlan mode is STA_AP



  • Hello, I hope this is the correct place to ask for help with my problem.

    I'm working with a SiPy and a Pytrack, firmware of both was updated today.

    os.uname() returns: (sysname='SiPy', nodename='SiPy', release='1.14.0.b1', version='v1.8.6-849-86da809 on 2018-01-17', machine='SiPy with ESP32', sigfox='1.0.1')

    After updating the firmware the FTPconnection was no longer possible with the code I was using before. I'm using FileZilla and the output I get looks like this:
    Status: Connecting to 192.168.4.1:21...
    Status: Connection established, waiting for welcome message...
    Status: Server does not support non-ASCII characters.
    Status: Logged in
    Status: Retrieving directory listing...
    Command: PWD
    Response: 257 /
    Command: TYPE I
    Response: 200
    Command: PASV
    Response: 227 (0,0,0,0,7,232)
    Command: LIST
    Error: The data connection could not be established: WSAEADDRNOTAVAIL - Cannot assign requested address
    Response: 150

    After some research I was abled to find the source of my problem. I used the following code:

    from network import WLAN
    wlan = WLAN(mode=WLAN.STA_AP,ssid='sipy-pytrack', auth=(WLAN.WPA2,'XXXX'))

    wlan.mode() returns: 3

    Using the default WLAN (wlan.mode() returns: 2) I have no problem connecting via FTP. Changing the mode in my code to WLAN.AP (wlan.mode() returns: 2) I'm able to connect to the FTP server. But this "solution" doesn't solve my problem, because it leads to a new error. The new error is that the command wlan.scan() doesn't work.

    Does someone else have the same problem or am I doing something wrong?
    Do I have to change how I connect with FileZilla?

    I hope somebody can help me.



  • WLAN ifconfig must be initialized with id 0 and not 1 (FTP doesn't know IP if you are on ID 1).



  • The issue lies with the response the FTP server gave your client:

    Command: PASV
    Response: 227 (0,0,0,0,7,232)

    The Pycom device is returning an invalid IP = 0.0.0.0.

    Try setting the IP manually with wlan.ifconfig().

    I have already inquired about this issue here:
    https://github.com/pycom/pycom-micropython-sigfox/issues/212

    Seems that the firmware should either offer more options as it related to FTP server functionality or properly handle the storage and use of the IP addresses for the PSV command.



  • I have the same problem on LoPy:

    os.uname()
    (sysname='LoPy', nodename='LoPy', release='1.18.1.r1', version='v1.8.6-849-b0520f1 on 2018-08-29', machine='LoPy with ESP32', lorawan='1.0.2')


 

Hello World?

Pylife on Kickstarter - November 2018








Back Us On Kickstarter >

Pycom on Twitter