How to use usb mass storage in ESP32?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
AmirJ
Posts: 26
Joined: Tue Sep 03, 2019 9:48 am

How to use usb mass storage in ESP32?

Post by AmirJ » Sun Sep 08, 2019 9:26 am

How to use usb in Host mede for mass storage in ESP32 or ESP8266?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: How to use usb mass storage in ESP32?

Post by Roberthh » Sun Sep 08, 2019 9:51 am

Unlike the Pyboard devices, the ESP32 and ESP8266 have no USB mass storage mode. The are connected by a UART link through a UART/USB bridge.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: How to use usb mass storage in ESP32?

Post by Roberthh » Sun Sep 08, 2019 10:00 am

You made several posts about transferring files, and it is not clear what you want to achieve. If you want to transfer files between an ESP8266/ESP32 and a PC, there are several options to do so. Using USB, its e.g. pyboard.py, rshell.py, ampy, ... Using WIFi, there is for instance webrepl and ftp. If you have a non-PC device, which sends data by UART and you want to capture that on a ESP8266 or ESP32, things are a little bit more tricky. You asked for flow control. That is available on Pyboard, but you can implement that on ESP8266/ESP32 too. You have to write an appropriate handler for that. And you have to implement anyhow some kind for integrity checks for that transferred data, if integrity is an issue.
So if you tell us what you want to achieve and the set-up you have, we might be better able to support you.

User avatar
AmirJ
Posts: 26
Joined: Tue Sep 03, 2019 9:48 am

Re: How to use usb mass storage in ESP32?

Post by AmirJ » Sun Sep 08, 2019 8:08 pm

Roberthh wrote:
Sun Sep 08, 2019 10:00 am
You made several posts about transferring files, and it is not clear what you want to achieve. If you want to transfer files between an ESP8266/ESP32 and a PC, there are several options to do so. Using USB, its e.g. pyboard.py, rshell.py, ampy, ... Using WIFi, there is for instance webrepl and ftp. If you have a non-PC device, which sends data by UART and you want to capture that on a ESP8266 or ESP32, things are a little bit more tricky. You asked for flow control. That is available on Pyboard, but you can implement that on ESP8266/ESP32 too. You have to write an appropriate handler for that. And you have to implement anyhow some kind for integrity checks for that transferred data, if integrity is an issue.
So if you tell us what you want to achieve and the set-up you have, we might be better able to support you.

Thank you for your careful attention.
I want to make an interface for an old cnc machine that only has the RS232 port.
I want this interface connect to computer via FTP.
I want this interface use USB mass storage instead of sd-card.

Christian Walther
Posts: 169
Joined: Fri Aug 19, 2016 11:55 am

Re: How to use usb mass storage in ESP32?

Post by Christian Walther » Sun Sep 08, 2019 8:25 pm

So, you don’t want the ESP to act as a mass storage device, but you want it to use another mass storage device? Regardless, that won’t work either due to the missing USB. I’m not sure if any MicroPython platform has drivers for that, even those that do have USB.

Assuming that your RS232 interface is not extremely timing-critical, something running Linux may be a better choice for your needs, such as an Onion Omega or a Raspberry Pi. I’m not sure if the UARTs of those have hardware flow control, but if the requirements aren’t too strict, you may be able to implement it outside of the UART in your application using GPIOs.

I assume you know that you need a level shifter to connect a microcontroller UART to an RS232 port, the voltages are different.

rpr
Posts: 99
Joined: Sat Oct 27, 2018 5:17 pm

Re: How to use usb mass storage in ESP32?

Post by rpr » Mon Sep 09, 2019 7:29 am

It is still not a 100% clear (to me at least) what exactly you want to do.

It looks to me that you want the ESP32 to act as an intermediary between your CNC machine with the serial port and another computer (a PC) which is probably not able to be physically/directly connected to the serial port on the CNC.

So the CNC program from the PC is transferred via ftp wirelessly to the ESP32 which then transfers it to the CNC machine via UART/serial.

Is this is what you want to do there may be other solutions e.g. (http://www.usconverters.com/serial-rs232-wi-fi-adapter). This is an industrial type of solution which essentially provides a virtual com port. It is more expensive but may be more reliable.

Also as @Christian Walter mentioned, a Raspberry Pi with a USB to serial cable (FTDI etc) could also do the job.

Post Reply