Hi all, I am a beginner and I am trying to use ESP32-S3 along with Tiny2040 in order to read some data coming from a generic device (for example a keyboard) via usb-c host of the Tiny2040.
Currently I have connected the two components on a breadboard. The ESP32 receive power from my laptop and two V+/- pins are connected to the Tiny2040 relative pins and so both components are up and running. Next stage is now connecting a keyboard to the Tiny2040 using its usb-c port (and the eventual read values will be forwarded to ESP32 via UART TX/RX). However using CircuitPython I cannot find a way to read data from the usb-c port on the Tiny2040. That port can work only as power-supply/flash-code or can actually be used to read data in input? Not sure if I misunderstood the component.
The usb-serial is just another serial device and you can read and write data.
What do you mean by “via usb-c host”? CircuitPython is just starting to implement USB-hostmode, it is not available yet. And for reading input from a keyboard, it must be able to talk to HID-devices as a host. And a keyboard is not a serial device. This will probably be available in a future CircuitPython version, but is not yet available. And once it is available, you can probably attach the keyboard directly to the ESP32-S3, which also has usb.
I am making some confusion here I guess. My intention is to “forward” keys pressed on a keyboard to my ESP32-S3. Initially I thought that (based on what I read online) that a Tiny2040 can work in that sense: receiving the input from the keyboard and forward the pressed key (via UART). If this is not right, how can I achieve pass the pressed keys to ESP-S3?
I think the most important thing is to understand how USB works. You have a host (usually a computer, in your case a microcontroller) and a device (keyboard, mouse, usb-stick). The host controls the device.
If you want to attach a keyboard to a microcontroller, the microcontroller must operate in host-mode. That is it must start negotiation with the device, query IDs, the USB-speed, keep track of connect/disconnect events and so on. This is all implemented in software. Or it should be. But for CircuitPython it is not implemented yet. With MicroPython and C++ you might be better covered, but I don’t really know.
Skipping the tiny2040 and connecting D-/D+ directly to the ESP32-S3 does not solve your problem, unless you run a firmware on the ESP32-S3 that does all the usb-host stuff I mentioned above.
Maybe I or somebody else on this forum can give you better advice if you tell us what you really want to do. Tell us about your project as a whole so we can understand the role of the keyboard, tiny2040 and esp32-S3.
I have a wired keyboard and I am trying to turn it to a wireless keyboard via bluetooth. I started to read some documentation about different components etc and I thought that using a ESP32-S3 (for the bluetooth part) with some other component to manage the USB keyboard (in my case Tiny2040) was a possible solution. However I have found a video that describe a similar project here which is using an ESP32 along with a usb-breakout: https://www.youtube.com/watch?v=WPlPRkPx1_8&list=WL&index=2&t=195s