greatscottgadgets/luna

Question: Luna as a USB-UART bridge

francis2tm opened this issue · 1 comments

Hello!
I was wondering if Luna can be used out of the box as USB-UART bridge with an example. Do you think it's possible to generate a DTR and a RTS signals? Essencially I want to use the ECP5 to act like a USB-UART bridge to interface a ESP32 with a computer. It'd be amazing if it'd be possible to flash firmware via the USB-UART bridge to the ESP32 too! And the ESP32 can use DTR and RTS signals to put itself it bootloader mode, like so:
image
Do you think it's possible?
Thanks a lot ;)

It's definitely possible, but would take a little gateware work.

There is an example in the repository, in examples/usb/acm_serial.py, of creating a device that shows up as a USB serial port (with TX looped back to RX in the example). The example uses a partial implementation of the CDC ACM specification, that can be found in luna/gateware/usb/devices/acm.py.

To create a complete USB-serial adapter you would need to combine that with some further logic that implements the UART side of the adapter. There is a simple transmitter in luna/gateware/interface/uart.py but not a receiver. You would also need to implement further parts of the CDC ACM spec in order to make the DTR and RTS signals controllable by the host.