Using the VCP of ESP 32 dev kit for communication

0romis
Posts: 4
Joined: Tue Apr 17, 2018 8:25 am

Using the VCP of ESP 32 dev kit for communication

Postby 0romis » Wed Jul 18, 2018 2:32 pm

Is it possible to use the USB VCP on a pc as a serial connection to the esp 32 and set up communication between PC and esp 32?

Thanks

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Using the VCP of ESP 32 dev kit for communication

Postby kolban » Wed Aug 08, 2018 11:54 pm

I had to google VCP and seem to find it to be "Virtual COM Port". When one connects an ESP32 dev kit to a Windows based PC it should immediately show up as a COM port. Writing down this comport causes the data to arrive at the RX UART of the ESP32. Reading from the comport will receive data written to the TX UART of the ESP32. This is the normal mode of usage for examining console logs and flashing new applications.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Using the VCP of ESP 32 dev kit for communication

Postby Deouss » Thu Aug 09, 2018 1:00 am

Any chances someone could write Esp32 usb driver for Windows?
I am looking into driver development kit but don't know where to start because there are few types of drivers

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

Re: Using the VCP of ESP 32 dev kit for communication

Postby ESP_Sprite » Thu Aug 09, 2018 1:30 am

Note that the ESP32 does not have built-in USB hardware (and that there at the moment is no software USB stack either)'; the USB port on the devkits is connected to a separate USB-to-serial converter (CP2104 or FT2232h, depending on the devboard.) The serial output of this chip is connected to the ESP32 chip. So theoretically, if you have the drivers for the USB-to-serial chip installed, any communication you do through it should be picked up as serial communications on the ESP32 side, and you can indeed 'talk' to the app running on the ESP32 that way.

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Using the VCP of ESP 32 dev kit for communication

Postby Deouss » Thu Aug 09, 2018 1:39 am

Yes I know - USB is just a protocol - no need for hardware if a simple protocol is implemented - just a matter of connecting all usb pins to board and PC. Problem would be what kind of usb device ESP would classify when recognized. Also usb driver requires vendor id.
Some info here :

https://www.beyondlogic.org/usbnutshell/usb1.shtml
http://www.usb.org/developers

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

Re: Using the VCP of ESP 32 dev kit for communication

Postby ESP_Sprite » Thu Aug 09, 2018 2:34 am

Again - there's no usb protocol implementation for the ESP32. As soon as someone comes up with one, the VID is no big problem (hey, Espressif has one we may allow people to use if needed) and even the code to 'act' as a certain device can happily be borrowed from things like libopencm3 or LUFA, but someone needs to write the low-level software to have the ESP32 'speak' USB, and that has not happened yet. It's also not trivial, as USB requires some pretty fast turnaround times that normally are handled by a dedicated internal USB peripheral, which the ESP32 does not have. At the moment, your question is akin to asking 'do cows speak amongst themselves in German or English?' and in the entire discussion ignoring that cows cannot talk in the first place.

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: Using the VCP of ESP 32 dev kit for communication

Postby Deouss » Thu Aug 09, 2018 2:59 am

I believe it could speak via RMT or SPI ? )
USB has different speed and transfer modes. Of course problem is not trivial at all and I never claimed that.
Communication process should have pretty high priority as task or critical section but it depends what kind of transfers
we would consider. WiFi is doing very good so why USB wouldn't do so?

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

Re: Using the VCP of ESP 32 dev kit for communication

Postby ESP_Sprite » Thu Aug 09, 2018 7:04 am

Deouss wrote:WiFi is doing very good so why USB wouldn't do so?
Because the ESP32 has internal support for WiFi and both the hardware and drivers are geared towards that. The ESP32 does not have internal support for USB, and in order to hack SPI or RMT to do USB work, a lot of very optimized code needs to be written in order to 'fake' USB; it may not even be reliably possible.

You know what? Because of other reasons, I more-or-less have all the answers to the questions you asked. As Espressif, we have a VID; we are working on some projects that need higher-level device drivers so we'll have these as well. This project is not for the current ESP32 chip however, so even if it would run on that chip, we're missing the lower-level hardware to actually send and receive the raw USB streams. If you write the code to instead send and receive these USB streams using the RMT or SPI peripheral, I'll provide all the rest for you.

Until that point, discussion about what to do with USB on the ESP32, unfortunately, is entirely moot.

Who is online

Users browsing this forum: No registered users and 62 guests