Hello,
I need to control a box (MixPre by Sound Systems) but have problems to get an idea whats wrong.
I use a ESP32S3 DevKit1 and I tried lot of samples. Summary: Working fine on a PC dosnt work on the box.
I can control the box with a hp USB keyboard and with a Logitech keyboard, but I doesnt respond to my ESP32S3.
Lastly I found out, that the call HID.ready() returns false. (True if I plug in a PC).
There must be some trick. I want to try to implement a 'Boot Keyboard', but the only sample I can find isn't usable with my kit.
The MixPre is the host (like a PC) and the SP32S3 DevKit1 is the keyboard device. I use the dedicated USB connector of the kit and the serial/Jtag plug for programming.
As mentioned, it works fine with the PC but fails with the box.
The box works fine with standard keyboards.
==> my ESP32S3 DevKit should exactly emulate a standard USB keyboard.
Yes. As I mentioned before, ALL samples working using a PC as the host, but I need to control a MixPre box and so I have to send Cntrl+r to start recording and Cntrl+s to stop recording during the ESP32S3 DevKit is connected to the MixPre (not to a PC) and exactly that fails for some reason.
I had the ESP32S3 USB keyboard device plugged into the same PC as the Arduino IDE for testing
it could be plugged into another device USB, e.g. a PC running Linux or your MixPre
this code transmits Linux commands to a ESP32S3 USB OTG keyboard device
// ESP32-S3-DevKit-1 USB Device Keyboard test
// send of sequence of commands to a Linux PC
// adapted from // File>Examples>USB>Keyboard>KeyboardSerial
// settings
// Tools>Board to ESP32-S3-USB-OTG
// Upload Mode "UART0/Hardware CDC"
// USB Mode "USB-OTG"
#include <Arduino.h>
#ifndef ARDUINO_USB_MODE
#error This ESP32 SoC has no Native USB interface
#elif ARDUINO_USB_MODE == 1
#warning This sketch should be used when USB is in OTG mode
void setup() {}
void loop() {}
#else
#include "USB.h"
#include "USBHIDKeyboard.h"
USBHIDKeyboard Keyboard;
void setup() {
// open the serial port:
Serial.begin(115200);
// initialize control over the keyboard:
Keyboard.begin();
USB.begin();
}
// send of sequence of commands to a Linux PC
void loop() {
delay(5000);
static String text[]={"ls", "ls /", "ls Public"}; // Linux commands
static int counter=0;
Serial.printf("Transmitting to keyboard '%s'\n", text[counter].c_str());
Keyboard.println(text[counter]);
if(++counter > 2)counter=0;
}
#endif /* ARDUINO_USB_MODE */
host PC Arduino IDE serial output
Transmitting to keyboard 'ls'
Transmitting to keyboard 'ls /'
Transmitting to keyboard 'ls Public'
Transmitting to keyboard 'ls'
Transmitting to keyboard 'ls /'
Transmitting to keyboard 'ls Public'
Transmitting to keyboard 'ls'
Transmitting to keyboard 'ls /'
Transmitting to keyboard 'ls Public'
the ESP32S3 OTG USB output is plugged into a USB port on a PC running Kbuntu where it appears to be a keyboard inputting commands to a kconsole
Exactly this was my idea last week and now I have learned, that the MixPre is different. I also ask Sound Systems, but they give no support, only telling me, that there were problems with BT dongles and wireless keyboards.
if the MixPre accepts standard USB keyboards I would think the ESP32S3 OTG keyboard device would work OK
in this program text entered on Serial Monitor are transmitted to OTG keyboard device - works to my Linux PC OK so should to your MixPre
// ESP32-S3-DevKit-1 USB Device Keyboard test
// adapted from File>Examples>USB>Keyboard>KeyboardSerial
// Tools>Board to ESP32-S3-USB-OTG
// Upload Mode "UART0/Hardware CDC"
// USB Mode "USB-OTG"
// text entered on Serial Monitor are transmitted to OTG keyboard device
#include <Arduino.h>
#ifndef ARDUINO_USB_MODE
#error This ESP32 SoC has no Native USB interface
#elif ARDUINO_USB_MODE == 1
#warning This sketch should be used when USB is in OTG mode
void setup() {}
void loop() {}
#else
#include "USB.h"
#include "USBHIDKeyboard.h"
USBHIDKeyboard Keyboard;
void setup() {
// open the serial port:
Serial.begin(115200);
Serial.println("enter text to transmit to OTG keyboard");
// initialize control over the keyboard:
Keyboard.begin();
USB.begin();
delay(1000);
//Keyboard.println("ls /");
}
void loop() {
// check for incoming serial data:
if (Serial.available() > 0) {
// read incoming serial data:
char inChar = Serial.read();
// transmit ASCII value
Keyboard.write(inChar);
}
}
#endif /* ARDUINO_USB_MODE */
Sorry, but this isn't the case. I am very frustrated about this. I also switched the MixPre on and off to clear some cache or whateerver internally happens. I also useed the same cable to connect to PC or MixPre, and yes, I tried different ones.
If it will be as eeasy as the sample sketches showing, I won't writing here in the forum.
An Arduino board emulating a USB keyboard (or mouse) almost always defaults to emulating two USB devices: keyboard and serial. These kinds of USB devices are referred as USB multi-function devices.
Computers running full operating systems such as Windows, Linux, MacOS, IOS, Android, etc. handle USB multi-function devices. Simple devices with USB host ports but are not running full OS usually do not work with multi-function devices.
You can try turning off the ESP32 build option "USB CDC on boot" to remove the USB serial device. The Arduino IDE uses the USB serial port to upload code so the IDE auto-upload no longer works. Use the ESP32 board buttons to put the ESP32 in bootload mode before uploading code.
Thanks for the info.
But I use an ESP32S3 DevKitC-1 and here I have two USB sockets. One socket is for programming (debugging not working for now) and the second one is a plain USB interface. As far as I can see (using USBDview tool) there is no CDC.
@customcontroller, exactly that is what I tried. The working keyboards creating a Composite device with two HID keyboards, what is strange to me.
My sketch creates this device:
This was very surprising to me. After this finding I try to do thee same, without success. I adapted the sample 'Composite Device', disableed all the Gamepad stuff, and get a composite device and a keyboard. But no idea to add a second kbd.
The hp-keyboard do exact the same things, the wireleess kbd creates a kbd deevice and a mouse device (there is no mouse, but ...) and this doesn't work with MixPre.
I do this teests last week and since I try everything ....