loboris / MicroPython_ESP32_psRAM_LoBo

MicroPython for ESP32 with psRAM support
Other
825 stars 342 forks source link

ftp server not support LAN? #201

Open phatpaul opened 6 years ago

phatpaul commented 6 years ago

import network import machine eth_if = network.LAN(mdc = machine.Pin(23), mdio = machine.Pin(18), power = machine.Pin(17), phy_type = network.PHY_LAN8720, phy_addr=0) eth_if.active(1) True eth_if.ifconfig() ('192.168.33.153', '255.255.255.0', '192.168.33.1', '192.168.33.1') network.ftp.start() E (307979) [Ftp_start]: WiFi not started or not connected False

Can you point me to where the FTP code is in this repository and I'll take a stab at hacking it?

phatpaul commented 6 years ago

Yikes, it looks like a lot of this micropython port (for ESP32) was written for WiFi only. I not going to butcher your code @loboris. Hopefully you can improve the Ethernet support someday.

Lots of references to WiFi in modnetwork.c which should also take into account Eth connection. https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/blob/master/MicroPython_BUILD/components/micropython/esp32/modnetwork.c

ftp.c also assumes Wifi only, since it is based off of Pycom's code (pycom modules don't seem to support Ethernet) https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/blob/master/MicroPython_BUILD/components/micropython/esp32/libs/ftp.c

Looks like I'm going back to using uftpd.py server for now.
https://github.com/robert-hh/FTP-Server-for-ESP8266-and-ESP32.git

loboris commented 6 years ago

I'm planning to make some improvements to the ethernet module next month and ftp/telnet support will be included.

loboris commented 6 years ago

The ethernet module has been update. Both Ftp server and Telnet server now works on any network interface (WiFi-STA, WiFi-AP, Ethernet). Multiple network interfaces can be active at the same time, FTP and Telnet will accept the connection on any of them.

phatpaul commented 6 years ago

Thanks Boris. I'm giving the new code a try.

I'm having trouble listing directory contents on the built-in FTP server.
The server is sending 227 (0,0,0,0,7,232) for passive mode - which should include the server's IP address.

Here's the Filezilla log: ''' Status: Connecting to 192.168.33.208: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: PORT 192,168,33,215,245,198 Response: 502 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 Error: Connection timed out after 20 seconds of inactivity Error: Failed to retrieve directory listing '''

Here's how I started the server: import network sta_if = network.WLAN(network.STA_IF) sta_if.active(1) sta_if.connect('xxx', 'xxx') sta_if.ifconfig() network.ftp.start(user="micro", password="python", buffsize=1024, timeout=300)

I haven't tried it with Ethernet yet... Unfortunately there's no dev board with the WROVER and Ethernet? But I'll try it on my Olimex ESP32-EVB.

loboris commented 6 years ago

Sorry, there is a bug in Ftp server in the latest update I've discovered today. The fix will be commited tomorrow.

loboris commented 6 years ago

The Ftp server bug fix is commited.

@phatpaul

Unfortunately there's no dev board with the WROVER and Ethernet?

External board like this one can be used. Small modification is needed: waveshare-lan8720-modifications

An expansion board for ESP32 Devkitc is also available.

bdespatis commented 6 years ago

I can check with my electric engineer. We can release files for jlcpcb and it would be cheap to build your own if someone doesn't have the skill to design it. We can also manufacture some and sell it, we have our new reflow oven to do small batches.

Let me know.