UART over USB (CDC/VCP)
ruben-iteng opened this issue · 6 comments
Describe the problem you have/What new integration you would like
I would like to have the option to use the USB hardware port on selected platforms (R2040, ESP32-C3/S2...) as UART bus. Similar to how the logger
component can use the USB_CDC as hardware port but then for the uart
component.
uart:
hardware_uart: USB_CDC
instead of rx/tx_pin
or port
Please describe your use case for this integration and alternatives you've tried:
With this functionality it is possible to write new/custom components that require UART over USB.
e.g. I could make an AT command component to control the ESPHome device with a host, or the other way around (some solar inverters use ModBus over USB CDC/VCP to communicate).
Additional context
like this one? esphome/esphome#7520
like this one? esphome/esphome#7520
I saw that pr, but I'm not sure it is the same issue. I'm really just looking to do this:
uart:
hardware_uart: USB_CDC
instead of rx/tx_pin
or port
should be as for now USB_CDC or USB_SERIAL_JTAG are only for logger. With this you could use it for anything else - as a standard serial port, HID on some never even as USB OTG.
should be as for now USB_CDC or USB_SERIAL_JTAG are only for logger. With this you could use it for anything else - as a standard serial port, HID on some never even as USB OTG.
Yes, thank you. I indeed looked into it a bit, but this also requires changes to the uart
component I expect. This features request is still valid in that case (independent from how other USB related things will be implemented).
I don't know the code base that well, but it might be a small change to support UART over USB already for the uart
component as it is already implemented for the logger
.
With this you could use it for anything else - as a standard serial port, HID on some never even as USB OTG.
Not exactly. USB OTG is a host function, can can't be used at the same time as USB client mode, which is what this request relates to. Using the USB-CDC or JTAG serial as a UART shouldn't be hard since it's built into the microcode and would not need changes to the UART component, just need to implement the UART class in a separate component. HID would need a significant amount of new code.
Sure not with the host one, but would be possible to make similar for otg... - mentioned that how it is with usb in general. And Tom is already working on HID.