Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to have NCM functionality along with REPL console at the the same USB port? (IEC-259) #128

Closed
2 tasks done
emaayan opened this issue Jan 26, 2025 · 6 comments
Labels
Resolution: Won't Do Issue will not be worked on Status: Done Issue is done internally

Comments

@emaayan
Copy link

emaayan commented Jan 26, 2025

Answers checklist.

  • I have read the documentation of the component in question and the issue is not addressed there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

i've been trying to do different combinations of settings to get the ability to both REPL console functionality (to be able to use putty and other serial terminals for cli) and at the same time still have USB port be recognized as a network card, but i can't seem to make it happen.

if i understand correctly one USB port can be used for serial communication (UART) which is by default used for REPL as well as uploading the firmware, the other USB port is used by default with jtag, as TUSB doesn't allow for debugging in jtag, (btw is it possible at all to debug in tinyusb mode?) it would seem to make sense that using CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG would allow me to get both console and networking on the same port.

Image

@espressif-bot espressif-bot added the Status: Opened Issue is new label Jan 26, 2025
@github-actions github-actions bot changed the title is it possible to have NCM functionality along with REPL console at the the same USB port? is it possible to have NCM functionality along with REPL console at the the same USB port? (IEC-259) Jan 26, 2025
@peter-marcisovsky
Copy link
Collaborator

peter-marcisovsky commented Jan 27, 2025

Hi @emaayan
On the esp32s3, there is only one USB PHY, which is shared between 2 peripherals:

  • USB-OTG Peripheral
  • USB Serial JTAG

Thus, you can have only one peripheral using the USB PHY at the time.
USB-OTG Peripheral can be used for running a USB application (USB Device, USB Host) or as a USB-OTG console
USB Serial JTAG Peripheral can be used for debugging or as a JTAG console.
Docs about console here

And you can have only one functionality from one peripheral using the USB PHY at the time. Meaning: you can't have a USB application and a USB-OTG console running at the same time.

In your case: You want to:

  • run a USB Application (USB NCM Device)
  • have a debugger
  • have a repl console running

You can do that, with a following workaround:

  • USB Connector on your esp32s3 board, will be occupied by the main USB Application (USB NCM Device)
  • The debugger will be run from JTAG interface (Not USB Serial JTAG interface !), for that, read this docs, and you will need a ESP-PROG board for debugging in this case.
  • The repl console environment can occupy the USB-UART Bridge (the same outuput used for flashing and monitoring) Or you can define your own custom UART Console, using a second UART peripheral (Custom UART Console) here

@emaayan
Copy link
Author

emaayan commented Jan 27, 2025

Hi @emaayan On the esp32s3, there is only one USB PHY, which is shared between 2 peripherals:

  • USB-OTG Peripheral
  • USB Serial JTAG

Thus, you can have only one peripheral using the USB PHY at the time. USB-OTG Peripheral can be used for running a USB application (USB Device, USB Host) or as a USB-OTG console USB Serial JTAG Peripheral can be used for debugging or as a JTAG console. Docs about console here

And you can have only one functionality from one peripheral using the USB PHY at the time. Meaning: you can't have a USB application and a USB-OTG console running at the same time.

In your case: You want to:

  • run a USB Application (USB NCM Device)
  • have a debugger
  • have a repl console running

You can do that, with a following workaround:

  • USB Connector on your esp32s3 board, will be occupied by the main USB Application (USB NCM Device)
  • The debugger will be run from JTAG interface (Not USB Serial JTAG interface !), for that, read this docs, and you will need a ESP-PROG board for debugging in this case.
  • The repl console environment can occupy the USB-UART Bridge (the same outuput used for flashing and monitoring) Or you can define your own custom UART Console, using a second UART peripheral (Custom UART Console) here

actually i gave up on debugging, i'd be happy if i could get REPL console and USB-NCM in the same usb port.

@peter-marcisovsky
Copy link
Collaborator

i'd be happy if i could get REPL console and USB-NCM in the same usb port

You could try creating a composite USB device with NCM and CDC interfaces and try to run some logging on the CDC interface. But I am afraid, you will not be able to run a REPL console on the TinyUSB's CDC interface.

Is there some specific reason why do you want to run repl console on the same port as your USB Device application?

@emaayan
Copy link
Author

emaayan commented Jan 27, 2025

i'd be happy if i could get REPL console and USB-NCM in the same usb port

You could try creating a composite USB device with NCM and CDC interfaces and try to run some logging on the CDC interface. But I am afraid, you will not be able to run a REPL console on the TinyUSB's CDC interface.

Is there some specific reason why do you want to run repl console on the same port as your USB Device application?

simplicity sake, currently i'm usiing REPL to display a cli for some configuration, and the other port i'm using for network interface to view http server and stream TCP, so if people need to change the IP they need both USB, and what i am for is people be using a regular ali express dev boards with s3 .

@peter-marcisovsky
Copy link
Collaborator

Regular esp32s3 dev boards feature both ports, if you are not targeting some of the mini series.
Anyway, the feature you are requesting is not available right now in esp-idf and we currently don't have any plan of supporting it. If you have other questions, feel free to ask, otherwise feel free to close the issue.

@emaayan emaayan closed this as completed Jan 28, 2025
@igrr
Copy link
Member

igrr commented Jan 28, 2025

But I am afraid, you will not be able to run a REPL console on the TinyUSB's CDC interface.

FWIW, while we don't provide a ready-made integration between tinyusb's CDC and esp_console componet's REPL, writing one is not too complex. esp_tinyusb component already provides a VFS driver, I think you can use that VFS driver together with esp_console APIs in way similar to the "advanced" console example in ESP-IDF.

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Won't Do Issue will not be worked on and removed Status: Opened Issue is new labels Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Won't Do Issue will not be worked on Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants