I'd like to connect my 8266s and ESP32s to my PC using USB, but with speeds similar to my USB flash drive, a USB camera, or a USB hard drive. The USB2 or USB3 into my PC is conservatively capable of tens of MB per second. Yet I go through a Serial Port adapter that can only do 115200 * 8 - about 100K bytes per second, at best. So it looks like my data rates are probably 100 times less than other common USB devices can achieve.
So what is fundamentally different about, say, a fast USB flash drive that makes it capable of much higher speeds?
And does anyone have any experience or recommendations for an adaptor board that might be able to talk SPI to my ESP, and then deliver fast data over USB to my PC? (For example, this one claims to support USB to SPI: https://www.banggood.com/CJMCU-4232-FT4 ... 16198.html)
Any experience, insights, or hints for me?
Thanks
Peter
What is required for fast USB connectivity?
-
- Posts: 9708
- Joined: Thu Nov 26, 2015 4:08 am
Re: What is required for fast USB connectivity?
Well, especially with USB2 and USB3, the answer is that these devices have dedicated data paths to move data quickly from storage to the USB port, without the processor itself having so much as to look at it. This is also why the ESP32 isn't going to have USB3 speeds - nothing in it is designed to get information out of the chip at GBits/second. To be fair, you can do a lot better than 115200 baud (which actually can do 115200 / 10 = 12KByte/second) by simply upping the baud rate to the maximum your USB-to-serial converter supports - up to 10MBaud (or 1MByte/second), which is the ESP32s maximum. If you need more, you may be able to use SPI master or SDIO to shift data out - I think these ports can go up to 4 bit and 80MHz, giving you a theoretical maximum of 40MByte/second of speed. I'll leave the USB adapter implementation up as an exercise for the reader, though.
Re: What is required for fast USB connectivity?
Thanks - it answers one important part of my question - one factor about "ordinary serial" vs USB flash drive speeds is getting the data shifted out fast. But I suspect the serial emulation is also a bottleneck. All fast USB devices seem to have special-purpose drivers, i.e. they don't appear as Serial Ports to the OS. I think my serial tops out at 115200 * 8 - about 1 meg baud.
My little OV7670 camera delivers scan lines via SPI, so the incoming data rates can be quite a few MB per second. Moving that data off-chip as it arrives (because there is insufficient memory for full frame buffering) is challenging.
I'm doing this for fun, so it's not a serious engineering decision to try to build an app like this. It's more about seeing how far I can stretch things, and knowing what the bottlenecks are, why they exist, and whether work-arounds exist.
My little OV7670 camera delivers scan lines via SPI, so the incoming data rates can be quite a few MB per second. Moving that data off-chip as it arrives (because there is insufficient memory for full frame buffering) is challenging.
I'm doing this for fun, so it's not a serious engineering decision to try to build an app like this. It's more about seeing how far I can stretch things, and knowing what the bottlenecks are, why they exist, and whether work-arounds exist.
Re: What is required for fast USB connectivity?
Do you know USB protocol well?
I was looking for good materials and examples and it is quite complex but feasible.
Reading mouse and keyboard wouldn't be a big problem however connecting to some other OS like Windows you must go through the software driver...
I wonder if there is some open source USB driver
I was looking for good materials and examples and it is quite complex but feasible.
Reading mouse and keyboard wouldn't be a big problem however connecting to some other OS like Windows you must go through the software driver...
I wonder if there is some open source USB driver
Who is online
Users browsing this forum: Majestic-12 [Bot] and 86 guests