TinyUSB definition errors on ESP32s3

I am having weird errors when trying to compile a sketch with a TinyUSB_Mouse_and_Keyboard.h
It seems like parts of the TinyUSB library are not getting defined and that is causing the issue.


The screenshot is a part of the code from the TinyUSB_Mouse_and_Keyboard.h library with the errors

Compiling .pio\build\esp32-s3-devkitc-1\src\main.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\lib1e2\Adafruit_TinyUSB_Library\arduino\Adafruit_TinyUSB_API.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\lib1e2\Adafruit_TinyUSB_Library\arduino\Adafruit_USBD_CDC.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\lib1e2\Adafruit_TinyUSB_Library\arduino\Adafruit_USBD_Device.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\lib1e2\Adafruit_TinyUSB_Library\arduino\hid\Adafruit_USBD_HID.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\lib1e2\Adafruit_TinyUSB_Library\arduino\midi\Adafruit_USBD_MIDI.cpp.o
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/arduino/Adafruit_TinyUSB_API.cpp:25:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
Compiling .pio\build\esp32-s3-devkitc-1\lib1e2\Adafruit_TinyUSB_Library\arduino\msc\Adafruit_USBD_MSC.cpp.o
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/arduino/Adafruit_USBD_CDC.cpp:25:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/arduino/Adafruit_USBD_Device.cpp:25:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/arduino/hid/Adafruit_USBD_HID.cpp:25:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/arduino/midi/Adafruit_USBD_MIDI.cpp:25:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
Compiling .pio\build\esp32-s3-devkitc-1\lib1e2\Adafruit_TinyUSB_Library\arduino\ports\esp32\Adafruit_TinyUSB_esp32.cpp.o
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/arduino/msc/Adafruit_USBD_MSC.cpp:25:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
Compiling .pio\build\esp32-s3-devkitc-1\lib1e2\Adafruit_TinyUSB_Library\arduino\ports\nrf\Adafruit_TinyUSB_nrf.cpp.o
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/arduino/ports/esp32/Adafruit_TinyUSB_esp32.cpp:25:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
Compiling .pio\build\esp32-s3-devkitc-1\lib1e2\Adafruit_TinyUSB_Library\arduino\webusb\Adafruit_USBD_WebUSB.cpp.o
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/arduino/ports/nrf/Adafruit_TinyUSB_nrf.cpp:25:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/arduino/webusb/Adafruit_USBD_WebUSB.cpp:25:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/Adafruit_TinyUSB.h:34,
                 from E:/projekty/smart-watch/libs/Adafruit_NeoPixel/Adafruit_NeoPixel.h:48,
                 from src/includes.h:8,
                 from src/functions.h:1,
                 from src/main.cpp:1:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
In file included from src/includes.h:17,
                 from src/functions.h:1,
                 from src/main.cpp:1:
E:/projekty/smart-watch/libs/IRremote/src/IRremote.hpp:220:2: warning: #warning INFO: For ESP32, RP2040, mbed and particle boards SEND_PWM_BY_TIMER is enabled by default. If this is not intended, deactivate the line over this warning message in file IRremote.hpp. [-Wcpp]
 #warning INFO: For ESP32, RP2040, mbed and particle boards SEND_PWM_BY_TIMER is enabled by default. If this is not intended, deactivate the line over this warning message in file IRremote.hpp.
  ^~~~~~~
Compiling .pio\build\esp32-s3-devkitc-1\lib7f7\TinyUSB_Mouse_and_Keyboard-master\TinyUSB_Mouse_and_Keyboard.cpp.o
In file included from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/tusb_option.h:179,
                 from E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/Adafruit_TinyUSB.h:34,
                 from E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:55:
E:/projekty/smart-watch/libs/Adafruit_TinyUSB_Library/src/common/tusb_mcu.h:275:4: warning: #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8" [-Wcpp]
   #warning "TUP_DCD_ENDPOINT_MAX is not defined for this MCU, default to 8"
    ^~~~~~~
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\USBCDC.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\USBMSC.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\WString.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\base64.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\cbuf.cpp.o
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\esp32-hal-adc.c.o
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\esp32-hal-bt.c.o
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\esp32-hal-cpu.c.o
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\esp32-hal-dac.c.o
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:66:35: error: 'HID_REPORT_ID' was not declared in this scope
     TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(RID_KEYBOARD) ),
                                   ^~~~~~~~~~~~~
Compiling .pio\build\esp32-s3-devkitc-1\FrameworkArduino\esp32-hal-gpio.c.o
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:66:35: note: suggested alternative: 'TUD_RHPORT_MODE'
     TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(RID_KEYBOARD) ),
                                   ^~~~~~~~~~~~~
                                   TUD_RHPORT_MODE
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:66:5: error: 'TUD_HID_REPORT_DESC_KEYBOARD' was not declared in this scope
     TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(RID_KEYBOARD) ),
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:67:32: error: 'HID_REPORT_ID' was not declared in this scope
     TUD_HID_REPORT_DESC_MOUSE( HID_REPORT_ID(RID_MOUSE) )
                                ^~~~~~~~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:67:32: note: suggested alternative: 'TUD_RHPORT_MODE'
     TUD_HID_REPORT_DESC_MOUSE( HID_REPORT_ID(RID_MOUSE) )
                                ^~~~~~~~~~~~~
                                TUD_RHPORT_MODE
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:67:5: error: 'TUD_HID_REPORT_DESC_MOUSE' was not declared in this scope
     TUD_HID_REPORT_DESC_MOUSE( HID_REPORT_ID(RID_MOUSE) )
     ^~~~~~~~~~~~~~~~~~~~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:67:5: note: suggested alternative: 'TUH_RHPORT_MODE'
     TUD_HID_REPORT_DESC_MOUSE( HID_REPORT_ID(RID_MOUSE) )
     ^~~~~~~~~~~~~~~~~~~~~~~~~
     TUH_RHPORT_MODE
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:70:3: error: 'Adafruit_USBD_HID' does not name a type
   Adafruit_USBD_HID usb_hid;
   ^~~~~~~~~~~~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp: In member function 'void TinyMouse_::begin()':
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:81:5: error: 'usb_hid' was not declared in this scope
     usb_hid.setPollInterval(2);
     ^~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:84:13: error: 'USBDevice' was not declared in this scope
     while( !USBDevice.mounted() ) delay(1);
             ^~~~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:84:13: note: suggested alternative: 'USBSerial'
     while( !USBDevice.mounted() ) delay(1);
             ^~~~~~~~~
             USBSerial
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp: In member function 'void TinyMouse_::move(int8_t, int8_t, int8_t)':
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:88:10: error: 'USBDevice' was not declared in this scope
     if ( USBDevice.suspended() )  {
          ^~~~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:88:10: note: suggested alternative: 'USBSerial'
     if ( USBDevice.suspended() )  {
          ^~~~~~~~~
          USBSerial
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:91:12: error: 'usb_hid' was not declared in this scope
     while(!usb_hid.ready()) delay(1);
            ^~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:92:5: error: 'usb_hid' was not declared in this scope
     usb_hid.mouseReport(RID_MOUSE,_buttons,x,y,wheel,0);
     ^~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp: In member function 'void TinyKeyboard_::begin()':
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:144:5: error: 'usb_hid' was not declared in this scope
     usb_hid.setPollInterval(2);
     ^~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:147:13: error: 'USBDevice' was not declared in this scope
     while( !USBDevice.mounted() ) delay(1);
             ^~~~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:147:13: note: suggested alternative: 'USBSerial'
     while( !USBDevice.mounted() ) delay(1);
             ^~~~~~~~~
             USBSerial
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp: In member function 'void TinyKeyboard_::sendReport(KeyReport*)':
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:156:10: error: 'USBDevice' was not declared in this scope
     if ( USBDevice.suspended() )  {
          ^~~~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:156:10: note: suggested alternative: 'USBSerial'
     if ( USBDevice.suspended() )  {
          ^~~~~~~~~
          USBSerial
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:159:12: error: 'usb_hid' was not declared in this scope
     while(!usb_hid.ready()) delay(1);
            ^~~~~~~
E:/projekty/smart-watch/libs/TinyUSB_Mouse_and_Keyboard-master/TinyUSB_Mouse_and_Keyboard.cpp:160:5: error: 'usb_hid' was not declared in this scope
     usb_hid.keyboardReport(RID_KEYBOARD,keys->modifiers,keys->keys);
     ^~~~~~~
*** [.pio\build\esp32-s3-devkitc-1\lib7f7\TinyUSB_Mouse_and_Keyboard-master\TinyUSB_Mouse_and_Keyboard.cpp.o] Error 1

This is my build output.

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
lib_extra_dirs = E:\projekty\smart-watch\libs
monitor_speed = 115200
board_build.f_cpu = 240000000
upload_speed = 921600
build_flags = 
	-DCORE_DEBUG_LEVEL=5
	-DUSE_TINYUSB=true
board_build.mcu = esp32s3
lib_archive = no

This is my platformio.ini file
I have tried altering the platformio.ini file, the “lib_archive = no” didn’t help and without “-DUSE_TINYUSB=true” there were a lot more issues.
Sorry for bad text formatting it’s my first time here

There seems to be a PlatformIO problem with the order of includes – the file “tusb_config.h” in the Adafruit library wants to

#elif defined(ARDUINO_ARCH_ESP32)
  // Use the BSP sdk/include/arduino_tinyusb/include/tusb_config.h
  #include <tusb_config.h>

but the include order in PlatformIO is so that libraries always come first before the core, so it will try to include itself but is then stopped by the include guards, leaving all the critical macros undefined.

I could temporarily fix that with

build_unflags = -DARDUINO_USB_MODE=1
build_flags =
   -DUSE_TINYUSB
   -DARDUINO_USB_MODE=0 
   '-DCFG_TUSB_CONFIG_FILE="C:\\Users\\Max\\.platformio\\packages\\framework-arduinoespressif32\\tools\\sdk\\esp32s3\\include\\arduino_tinyusb\\include\\tusb_config.h"'

but that requires a full path. So instead I decided to just copy the tusb_config.h file in the include/ folder of the project as tusb_config_esp32.h and do

build_flags =
   -DUSE_TINYUSB
   -DARDUINO_USB_MODE=0 
   -Iinclude/
   '-DCFG_TUSB_CONFIG_FILE="tusb_config_esp32.h"'

The only compile error is then

.pio/libdeps/esp32-s3-devkitc-1/Adafruit TinyUSB Library/src/arduino/webusb/Adafruit_USBD_WebUSB.cpp: In constructor 'Adafruit_USBD_WebUSB::Adafruit_USBD_WebUSB(const void*)':
.pio/libdeps/esp32-s3-devkitc-1/Adafruit TinyUSB Library/src/arduino/webusb/Adafruit_USBD_WebUSB.cpp:151:3: error: 'USB' was not declared in this scope
   USB.usbVersion(0x0210);
   ^~~

because apparently even in the latest TinyUSB version, they forget to include the USB.h header so that the USB object is declared. So I added that include to the Adafruit_USBD_WebUSB.cpp file.

And then…

Linking .pio\build\esp32-s3-devkitc-1\firmware.elf
Retrieving maximum program size .pio\build\esp32-s3-devkitc-1\firmware.elf
Checking size .pio\build\esp32-s3-devkitc-1\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.2% (used 13900 bytes from 327680 bytes)
Flash: [=         ]   6.6% (used 219865 bytes from 3342336 bytes)
Building .pio\build\esp32-s3-devkitc-1\firmware.bin
esptool.py v3.3
Creating esp32s3 image...
Merged 2 ELF sections
Successfully created esp32s3 image.
=== [SUCCESS] Took 30.96 seconds ===

I reported the fix in Fix compile error for missing "USB" definition by maxgerhardt · Pull Request #202 · adafruit/Adafruit_TinyUSB_Arduino · GitHub and you can use the reference project GitHub - maxgerhardt/pio-esp32s3-tinyusb: PlatformIO example that uses ESP32S3 with TinyUSB..

It only compiles, since I don’t have a board, I can’t test further.

1 Like

Thanks for the reply.
I did everything you described and it also compiled with my code, but when I call Keyboard.begin() it just get stuck in the loop.
So I modified the loop so it just returns false when it gets stuck:

bool TinyKeyboard_::begin(void)
  {
    usb_hid.setPollInterval(2);
    usb_hid.setReportDescriptor(desc_hid_report, sizeof(desc_hid_report));
    usb_hid.begin();
    long starttime = millis();
    while(!USBDevice.mounted() && millis() - starttime <= 5000) delay(1);
    if (millis() - starttime >= 5000) return false;
    return true;
  }

Still the keyboard doesn’t initialize. It just returns false after 5 seconds. And the USB of my custom board is good because the USB serial port is working sometimes.
And also is it required to have the USB cable connected on startup or not, because I am not initializing the keyboard lib on startup but later in the code.

Can you try the reference sketch Adafruit_TinyUSB_Arduino/hid_gamepad.ino at master · adafruit/Adafruit_TinyUSB_Arduino · GitHub?

Also I just noticed that when I plug in the USB cable before initializing the keyboard, but after startup Windows detects it as a unknown device:
image
And if I connect the USB cable while it is in the initializing loop it gets detected as a serial port.

I modified the sketch so it uses the hardware serial port only for communication.

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x9 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x39c
load:0x403c9700,len:0x9bc
load:0x403cc700,len:0x28dc
SHA-256 comparison failed:
Calculated: 5830b36eadda2ccdc73ac0028cd665f9a0ae0dcfc1ccf372c71f9cc6bad2ccc4
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x403c98c0
[   103][D][esp32-hal-tinyusb.c:673] tinyusb_enable_interface(): Interface HID enabled

That is my output, it still opens a USB serial port but nothing gets sent through it.

/*********************************************************************
 Adafruit invests time and resources providing this open source code,
 please support Adafruit and open-source hardware by purchasing
 products from Adafruit!
 MIT license, check LICENSE for more information
 Copyright (c) 2021 NeKuNeKo for Adafruit Industries
 All text above, and the splash screen below must be included in
 any redistribution
*********************************************************************/
#include <Arduino.h>
#include "Adafruit_TinyUSB.h"

/* This sketch demonstrates USB HID gamepad use.
 * This sketch is only valid on boards which have native USB support
 * and compatibility with Adafruit TinyUSB library. 
 * For example SAMD21, SAMD51, nRF52840.
 * 
 * Make sure you select the TinyUSB USB stack if you have a SAMD board.
 * You can test the gamepad on a Windows system by pressing WIN+R, writing Joy.cpl and pressing Enter.
 */

// HID report descriptor using TinyUSB's template
// Single Report (no ID) descriptor
uint8_t const desc_hid_report[] =
{
  TUD_HID_REPORT_DESC_GAMEPAD()
};

// USB HID object. For ESP32 these values cannot be changed after this declaration
// desc report, desc len, protocol, interval, use out endpoint
Adafruit_USBD_HID usb_hid(desc_hid_report, sizeof(desc_hid_report), HID_ITF_PROTOCOL_NONE, 2, false);

// Report payload defined in src/class/hid/hid.h
// - For Gamepad Button Bit Mask see  hid_gamepad_button_bm_t
// - For Gamepad Hat    Bit Mask see  hid_gamepad_hat_t
hid_gamepad_report_t    gp;

void setup() 
{
#if defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_RP2040)
  // Manual begin() is required on core without built-in support for TinyUSB such as mbed rp2040
  TinyUSB_Device_Init(0);
#endif

  Serial1.begin(115200);
  
  // Notes: following commented-out functions has no affect on ESP32
  // usb_hid.setPollInterval(2);
  // usb_hid.setReportDescriptor(desc_hid_report, sizeof(desc_hid_report));

  usb_hid.begin();

  // wait until device mounted
  while( !TinyUSBDevice.mounted() ) delay(1);
  
  Serial1.println("Adafruit TinyUSB HID Gamepad example");
}

void loop() 
{ 
//  // Remote wakeup
//  if ( TinyUSBDevice.suspended() && btn )
//  {
//    // Wake up host if we are in suspend mode
//    // and REMOTE_WAKEUP feature is enabled by host
//    TinyUSBDevice.remoteWakeup();
//  }

  if ( !usb_hid.ready() ) return;

  // Reset buttons
  Serial1.println("No pressing buttons");
  gp.x       = 0;
  gp.y       = 0;
  gp.z       = 0;
  gp.rz      = 0;
  gp.rx      = 0;
  gp.ry      = 0;
  gp.hat     = 0;
  gp.buttons = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  
  // Hat/DPAD UP
  Serial1.println("Hat/DPAD UP");
  gp.hat = 1; // GAMEPAD_HAT_UP;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD UP RIGHT
  Serial1.println("Hat/DPAD UP RIGHT");
  gp.hat = 2; // GAMEPAD_HAT_UP_RIGHT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD RIGHT
  Serial1.println("Hat/DPAD RIGHT");
  gp.hat = 3; // GAMEPAD_HAT_RIGHT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD DOWN RIGHT
  Serial1.println("Hat/DPAD DOWN RIGHT");
  gp.hat = 4; // GAMEPAD_HAT_DOWN_RIGHT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

   // Hat/DPAD DOWN
  Serial1.println("Hat/DPAD DOWN");
  gp.hat = 5; // GAMEPAD_HAT_DOWN;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Hat/DPAD DOWN LEFT
  Serial1.println("Hat/DPAD DOWN LEFT");
  gp.hat = 6; // GAMEPAD_HAT_DOWN_LEFT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD LEFT
  Serial1.println("Hat/DPAD LEFT");
  gp.hat = 7; // GAMEPAD_HAT_LEFT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD UP LEFT
  Serial1.println("Hat/DPAD UP LEFT");
  gp.hat = 8; // GAMEPAD_HAT_UP_LEFT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD CENTER
  Serial1.println("Hat/DPAD CENTER");
  gp.hat = 0; // GAMEPAD_HAT_CENTERED;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  
  // Joystick 1 UP
  Serial1.println("Joystick 1 UP");
  gp.x = 0;
  gp.y = -127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Joystick 1 DOWN
  Serial1.println("Joystick 1 DOWN");
  gp.x = 0;
  gp.y = 127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Joystick 1 RIGHT
  Serial1.println("Joystick 1 RIGHT");
  gp.x = 127;
  gp.y = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Joystick 1 LEFT
  Serial1.println("Joystick 1 LEFT");
  gp.x = -127;
  gp.y = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Joystick 1 CENTER
  Serial1.println("Joystick 1 CENTER");
  gp.x = 0;
  gp.y = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);


  // Joystick 2 UP
  Serial1.println("Joystick 2 UP");
  gp.z  = 0;
  gp.rz = 127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Joystick 2 DOWN
  Serial1.println("Joystick 2 DOWN");
  gp.z  = 0;
  gp.rz = -127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Joystick 2 RIGHT
  Serial1.println("Joystick 2 RIGHT");
  gp.z  = 127;
  gp.rz = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Joystick 2 LEFT
  Serial1.println("Joystick 2 LEFT");
  gp.z  = -127;
  gp.rz = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Joystick 2 CENTER
  Serial1.println("Joystick 2 CENTER");
  gp.z  = 0;
  gp.rz = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);


  // Analog Trigger 1 UP
  Serial1.println("Analog Trigger 1 UP");
  gp.rx = 127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Analog Trigger 1 DOWN
  Serial1.println("Analog Trigger 1 DOWN");
  gp.rx = -127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Analog Trigger 1 CENTER
  Serial1.println("Analog Trigger 1 CENTER");
  gp.rx = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);


  // Analog Trigger 2 UP
  Serial1.println("Analog Trigger 2 UP");
  gp.ry = 127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Analog Trigger 2 DOWN
  Serial1.println("Analog Trigger 2 DOWN");
  gp.ry = -127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Analog Trigger 2 CENTER
  Serial1.println("Analog Trigger 2 CENTER");
  gp.ry = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  
  // Test buttons (up to 32 buttons)
  for (int i=0; i<32; ++i)
  {
    Serial1.print("Pressing button "); Serial1.println(i);
    gp.buttons = (1U << i);
    usb_hid.sendReport(0, &gp, sizeof(gp));
    delay(1000);
  }


  // Random touch
  Serial1.println("Random touch");
  gp.x       = random(-127, 128);
  gp.y       = random(-127, 128);
  gp.z       = random(-127, 128);
  gp.rz      = random(-127, 128);
  gp.rx      = random(-127, 128);
  gp.ry      = random(-127, 128);
  gp.hat     = random(0,      9);
  gp.buttons = random(0, 0xffff);
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // */
}

This is my slightly modified sketch.
I am using all the fixes you previously sent me.
Nothing except the serial port appears in the device manager.

This is my platformio.ini file:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
lib_extra_dirs = E:\projekty\smart-watch\libs
monitor_speed = 115200
board_build.f_cpu = 240000000
upload_speed = 921600
board_build.mcu = esp32s3

build_unflags = -DARDUINO_USB_MODE=1
build_flags =
	-DCORE_DEBUG_LEVEL=5
	-DUSE_TINYUSB
	-DARDUINO_USB_MODE=0 
	-Iinclude/
	'-DCFG_TUSB_CONFIG_FILE="tusb_config_esp32.h"'
lib_archive = no

TinyUSB has debug logs which you can activate. Please use

build_flags =
   -DCORE_DEBUG_LEVEL=5
   -DUSE_TINYUSB
   -DARDUINO_USB_MODE=0 
   -Iinclude/
   '-DCFG_TUSB_CONFIG_FILE="tusb_config_esp32.h"'
   -DCFG_TUSB_DEBUG=2
   -DCFG_TUSB_DEBUG_PRINTF=TinyUSB_Ser1Debug

and add the function

#include <stdarg.h>
extern "C" int TinyUSB_Ser1Debug(const char *format, ...) {
  char buf[256];
  int len;
  va_list ap;
  va_start(ap, format);
  len = vsnprintf(buf, sizeof(buf), format, ap);
  Serial1.write(buf);
  va_end(ap);
  return len;
}

to the src\main.cpp. Does it show more info?

Serial output, there is even less then there was before:

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x9 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x39c 
load:0x403c9700,len:0x9bc 
load:0x403cc700,len:0x28dc
SHA-256 comparison failed:
Calculated: 5830b36eadda2ccdc73ac0028cd665f9a0ae0dcfc1ccf372c71f9cc6bad2ccc4
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x403c98c0

platformio.ini file:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
lib_extra_dirs = E:\projekty\smart-watch\libs
monitor_speed = 115200
board_build.f_cpu = 240000000
upload_speed = 921600
board_build.mcu = esp32s3

build_unflags = -DARDUINO_USB_MODE=1
build_flags =
   -DUSE_TINYUSB
   -DARDUINO_USB_MODE=0 
   -Iinclude/
   '-DCFG_TUSB_CONFIG_FILE="tusb_config_esp32.h"'
   -DCFG_TUSB_DEBUG=2
   -DCFG_TUSB_DEBUG_PRINTF=TinyUSB_Ser1Debug
lib_archive = no

code:

/*********************************************************************
 Adafruit invests time and resources providing this open source code,
 please support Adafruit and open-source hardware by purchasing
 products from Adafruit!
 MIT license, check LICENSE for more information
 Copyright (c) 2021 NeKuNeKo for Adafruit Industries
 All text above, and the splash screen below must be included in
 any redistribution
*********************************************************************/
#include <Arduino.h>
#include "Adafruit_TinyUSB.h"

/* This sketch demonstrates USB HID gamepad use.
 * This sketch is only valid on boards which have native USB support
 * and compatibility with Adafruit TinyUSB library. 
 * For example SAMD21, SAMD51, nRF52840.
 * 
 * Make sure you select the TinyUSB USB stack if you have a SAMD board.
 * You can test the gamepad on a Windows system by pressing WIN+R, writing Joy.cpl and pressing Enter.
 */

// HID report descriptor using TinyUSB's template
// Single Report (no ID) descriptor
uint8_t const desc_hid_report[] =
{
  TUD_HID_REPORT_DESC_GAMEPAD()
};

// USB HID object. For ESP32 these values cannot be changed after this declaration
// desc report, desc len, protocol, interval, use out endpoint
Adafruit_USBD_HID usb_hid(desc_hid_report, sizeof(desc_hid_report), HID_ITF_PROTOCOL_NONE, 2, false);

// Report payload defined in src/class/hid/hid.h
// - For Gamepad Button Bit Mask see  hid_gamepad_button_bm_t
// - For Gamepad Hat    Bit Mask see  hid_gamepad_hat_t
hid_gamepad_report_t    gp;

#include <stdarg.h>
extern "C" int TinyUSB_Ser1Debug(const char *format, ...) {
  char buf[256];
  int len;
  va_list ap;
  va_start(ap, format);
  len = vsnprintf(buf, sizeof(buf), format, ap);
  Serial1.write(buf);
  va_end(ap);
  return len;
}

void setup() 
{
#if defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_RP2040)
  // Manual begin() is required on core without built-in support for TinyUSB such as mbed rp2040
  TinyUSB_Device_Init(0);
#endif

  Serial1.begin(115200);
  
  // Notes: following commented-out functions has no affect on ESP32
  // usb_hid.setPollInterval(2);
  // usb_hid.setReportDescriptor(desc_hid_report, sizeof(desc_hid_report));

  usb_hid.begin();

  // wait until device mounted
  while( !TinyUSBDevice.mounted() ) delay(1);
  
  Serial1.println("Adafruit TinyUSB HID Gamepad example");
}

void loop() 
{ 
//  // Remote wakeup
//  if ( TinyUSBDevice.suspended() && btn )
//  {
//    // Wake up host if we are in suspend mode
//    // and REMOTE_WAKEUP feature is enabled by host
//    TinyUSBDevice.remoteWakeup();
//  }

  if ( !usb_hid.ready() ) return;

  // Reset buttons
  Serial1.println("No pressing buttons");
  gp.x       = 0;
  gp.y       = 0;
  gp.z       = 0;
  gp.rz      = 0;
  gp.rx      = 0;
  gp.ry      = 0;
  gp.hat     = 0;
  gp.buttons = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  
  // Hat/DPAD UP
  Serial1.println("Hat/DPAD UP");
  gp.hat = 1; // GAMEPAD_HAT_UP;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD UP RIGHT
  Serial1.println("Hat/DPAD UP RIGHT");
  gp.hat = 2; // GAMEPAD_HAT_UP_RIGHT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD RIGHT
  Serial1.println("Hat/DPAD RIGHT");
  gp.hat = 3; // GAMEPAD_HAT_RIGHT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD DOWN RIGHT
  Serial1.println("Hat/DPAD DOWN RIGHT");
  gp.hat = 4; // GAMEPAD_HAT_DOWN_RIGHT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

   // Hat/DPAD DOWN
  Serial1.println("Hat/DPAD DOWN");
  gp.hat = 5; // GAMEPAD_HAT_DOWN;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Hat/DPAD DOWN LEFT
  Serial1.println("Hat/DPAD DOWN LEFT");
  gp.hat = 6; // GAMEPAD_HAT_DOWN_LEFT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD LEFT
  Serial1.println("Hat/DPAD LEFT");
  gp.hat = 7; // GAMEPAD_HAT_LEFT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD UP LEFT
  Serial1.println("Hat/DPAD UP LEFT");
  gp.hat = 8; // GAMEPAD_HAT_UP_LEFT;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Hat/DPAD CENTER
  Serial1.println("Hat/DPAD CENTER");
  gp.hat = 0; // GAMEPAD_HAT_CENTERED;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  
  // Joystick 1 UP
  Serial1.println("Joystick 1 UP");
  gp.x = 0;
  gp.y = -127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Joystick 1 DOWN
  Serial1.println("Joystick 1 DOWN");
  gp.x = 0;
  gp.y = 127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Joystick 1 RIGHT
  Serial1.println("Joystick 1 RIGHT");
  gp.x = 127;
  gp.y = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Joystick 1 LEFT
  Serial1.println("Joystick 1 LEFT");
  gp.x = -127;
  gp.y = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Joystick 1 CENTER
  Serial1.println("Joystick 1 CENTER");
  gp.x = 0;
  gp.y = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);


  // Joystick 2 UP
  Serial1.println("Joystick 2 UP");
  gp.z  = 0;
  gp.rz = 127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Joystick 2 DOWN
  Serial1.println("Joystick 2 DOWN");
  gp.z  = 0;
  gp.rz = -127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Joystick 2 RIGHT
  Serial1.println("Joystick 2 RIGHT");
  gp.z  = 127;
  gp.rz = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Joystick 2 LEFT
  Serial1.println("Joystick 2 LEFT");
  gp.z  = -127;
  gp.rz = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Joystick 2 CENTER
  Serial1.println("Joystick 2 CENTER");
  gp.z  = 0;
  gp.rz = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);


  // Analog Trigger 1 UP
  Serial1.println("Analog Trigger 1 UP");
  gp.rx = 127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Analog Trigger 1 DOWN
  Serial1.println("Analog Trigger 1 DOWN");
  gp.rx = -127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Analog Trigger 1 CENTER
  Serial1.println("Analog Trigger 1 CENTER");
  gp.rx = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);


  // Analog Trigger 2 UP
  Serial1.println("Analog Trigger 2 UP");
  gp.ry = 127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);
  
  // Analog Trigger 2 DOWN
  Serial1.println("Analog Trigger 2 DOWN");
  gp.ry = -127;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // Analog Trigger 2 CENTER
  Serial1.println("Analog Trigger 2 CENTER");
  gp.ry = 0;
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  
  // Test buttons (up to 32 buttons)
  for (int i=0; i<32; ++i)
  {
    Serial1.print("Pressing button "); Serial1.println(i);
    gp.buttons = (1U << i);
    usb_hid.sendReport(0, &gp, sizeof(gp));
    delay(1000);
  }


  // Random touch
  Serial1.println("Random touch");
  gp.x       = random(-127, 128);
  gp.y       = random(-127, 128);
  gp.z       = random(-127, 128);
  gp.rz      = random(-127, 128);
  gp.rx      = random(-127, 128);
  gp.ry      = random(-127, 128);
  gp.hat     = random(0,      9);
  gp.buttons = random(0, 0xffff);
  usb_hid.sendReport(0, &gp, sizeof(gp));
  delay(2000);

  // */
}

Okay there’s less logs because I removed the CORE_DEBUG=5 macro. But other than that, TinyUSB doesn’t even seem to be called.

I noticed that the core prepackages a TinyUSB version itself – maybe it’s colliding with what the adafruit tinyusb library tries to also compile in. ESP-IDF has a pure TinyUSB example at esp-idf/tusb_hid_example_main.c at master · espressif/esp-idf · GitHub, and I’ve ported it to Arduino up to it compiling. Can you checkout GitHub - maxgerhardt/pio-tinyusb-esp-test?

Can you test the official sketch arduino-esp32/KeyboardAndMouseControl.ino at master · espressif/arduino-esp32 · GitHub with the configuration

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
build_unflags = -DARDUINO_USB_MODE=1
build_flags =
   -DARDUINO_USB_MODE=0 
lib_archive = no
; definitely exclude adafruit tinyusb, use built-in.
lib_ignore = Adafruit TinyUSB Library

?

That’s supposed to be working if they publish it in the core.

After changing the pins so it works with my 3x3 matrix it works!
It still prints this to the serial monitor thought:

Calculated: 5830b36eadda2ccdc73ac0028cd665f9a0ae0dcfc1ccf372c71f9cc6bad2ccc4
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x403c98c0
[ 21560][E][USBHID.cpp:340] SendReport(): report 1 wait failed
[ 21660][E][USBHID.cpp:340] SendReport(): report 1 wait failed
[ 22805][E][USBHID.cpp:340] SendReport(): report 1 wait failed
[ 22905][E][USBHID.cpp:340] SendReport(): report 1 wait failed
[ 23605][E][USBHID.cpp:340] SendReport(): report 1 wait failed
[ 23705][E][USBHID.cpp:340] SendReport(): report 1 wait failed
[ 25150][E][USBHID.cpp:340] SendReport(): report 1 wait failed
[ 25250][E][USBHID.cpp:340] SendReport(): report 1 wait failed
[ 85900][E][USBHID.cpp:340] SendReport(): report 2 wait failed
[ 87665][E][USBHID.cpp:340] SendReport(): report 2 wait failed
[ 88140][E][USBHID.cpp:340] SendReport(): report 2 wait failed
[ 88485][E][USBHID.cpp:340] SendReport(): report 2 wait failed
[ 88710][E][USBHID.cpp:340] SendReport(): report 2 wait failed
[ 88900][E][USBHID.cpp:340] SendReport(): report 2 wait failed
[ 89005][E][USBHID.cpp:340] SendReport(): report 2 wait failed

Those errors are weird but it works.
The report 2 is mouse
The report 1 is keyboard

Well that’s at least partly a success, so maybe you don’t exactly need the TinyUSB stack, but whatever that USB sketch is using.

Still, I don’t see why TinyUSB shouldn’t be working too, they explicitly state ESP32S2 and S3 support in their code (and also make sure you only use the library with those chips).

Did you try getting TinyUSB to work within the Arduino IDE? Does it also have compilation errors there or doesn’t work? If yes, can you report that to Issues · espressif/arduino-esp32 · GitHub?

I think I am just going to leave it there, I adapted that code for my smart watch and now it is working perfectly.

thank you so much for the fix