Skip to content

Use ESP32-S2 on-chip usb interface for console I/O for the esp32 s2 (was issue #1190) #2337

Description

@schnef

This issue was solved and did work well. I recently tried to compile v0.7.0-alpha.1 on the wemos s2 mini (the same board as before), but again no usb console output. The same problem is with the xiao esp32s3 board.

The compiler complained about some depreciated tiny-usb includes so I made the following changes:

modified   src/platforms/esp32/main/main.c
@@ -44,8 +44,8 @@
 void init_usb_serial(void);
 #include "tinyusb.h"
 #include "tinyusb_default_config.h"
-#include "tusb_cdc_acm.h"
-#include "tusb_console.h"
+#include "tinyusb_cdc_acm.h"
+#include "tinyusb_console.h"
 #endif
 
 #include "esp32_sys.h"
@@ -155,10 +155,9 @@ void init_usb_serial()
     ESP_ERROR_CHECK(tinyusb_driver_install(&tusb_cfg));
 
     tinyusb_config_cdcacm_t acm_cfg = { 0 }; // the configuration uses default values
-    ESP_ERROR_CHECK(tusb_cdc_acm_init(&acm_cfg));
-
-    esp_tusb_init_console(TINYUSB_CDC_ACM_0); // log to usb
-
-    ESP_LOGI(TAG, "USB initialization: done.");
+    ESP_ERROR_CHECK(tinyusb_cdcacm_init(&acm_cfg));
+    ESP_ERROR_CHECK(tinyusb_console_init(TINYUSB_CDC_ACM_0));
+    
+    ESP_LOGI(TAG, "USB initialization DONE");
 }
 #endif

Building AtomVM does give this message:

info: INFO: Symbol TINYUSB_CDC_ENABLED defined in multiple locations (see below). Please check if this is a correct behavior or a random name match:
    /home/frans/AtomVM/src/platforms/esp32/managed_components/espressif__esp_tinyusb/Kconfig:155
    /home/frans/AtomVM/src/platforms/esp32/main/Kconfig.projbuild:36

After flashing AtomVM and resetting, dmesg gives the output:

[330371.126213] usb 1-3: new full-speed USB device number 13 using xhci_hcd
[330371.317150] usb 1-3: New USB device found, idVendor=303a, idProduct=4001, bcdDevice= 1.00
[330371.317165] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[330371.317173] usb 1-3: Product: Espressif Device
[330371.317178] usb 1-3: Manufacturer: Espressif Systems
[330371.317183] usb 1-3: SerialNumber: 123456
[330371.320673] cdc_acm 1-3:1.0: ttyACM0: USB ACM device

Any advice on solving this issue?
TIA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions