The USB Serial object that is created for the MINIMA use the _SerialUSB class which is a subclass of the HardwareSerial class. It has several additional methods including:
uint32_t baud() {
return _bps;
}
uint8_t stopbits() {
return _stop;
}
uint8_t paritytype() {
return _parity;
}
uint8_t numbits() {
return _bits;
}
bool dtr() {
// this means we are actively using dtr signal, so ignore its meaning as "serial port open"
ignore_dtr = true;
return (_dtr != 0);
}
bool rts() {
return (_rts != 0);
}
The WIFI on the other hand, is simply: #define Serial UART1
So sketches that make use of these methods will compile fine on the MINIMA but not on the WIFI and likewise function properly. Such sketches like USB To Serial, Servo drivers, etc.
Not sure of the best way to fix: My best guess is that on WIFI it should still be using the _SerialUSB class, but with a different implementation.
However, I have no idea how to implement this. In particular:
Specifically, when the ESP32 receives the CDC_SET_LINE_CODING message on endpoint 0, what does it do with it? Is the information contained in it somehow made available to the main processor? likewise for CDC_STATUS_INTERFACE? Those messages contain the information, like baud rate, parity, stop bits... Likewise the state of the DTR and RTS.
To follow up on a question I was asking myself in the closed issue.
Does Serial.baud() work as I would expect on the MINIMA and return the current baud rate that the host is set to. So did a quick and dirty sketch:
Which implies I could use one of these boards as a simple USB To Serial Adapter, i.e. in a similar way I might use an FTDI cable. Could probably even flash on old UNO.
As I implied in the first post, this sketch does not compile on the WIFI.
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -Wall -Wextra -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib -DF_CPU=48000000 -DNO_USB -DBACKTRACE_SUPPORT -DARDUINO_UNOR4_WIFI -MMD -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\E3B24E659668E10C130DFE1EDEF6C45C/USB_Serial_Test_change_baud.ino\"" -DARDUINO_UNOWIFIR4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/includes.txt" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\E3B24E659668E10C130DFE1EDEF6C45C\\sketch\\USB_Serial_Test_change_baud.ino.cpp" -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\E3B24E659668E10C130DFE1EDEF6C45C\\sketch\\USB_Serial_Test_change_baud.ino.cpp.o"
C:\Users\kurte\Documents\Arduino\R4-Uno-wifi\USB_Serial_Test_change_baud\USB_Serial_Test_change_baud.ino: In function 'void loop()':
C:\Users\kurte\Documents\Arduino\R4-Uno-wifi\USB_Serial_Test_change_baud\USB_Serial_Test_change_baud.ino:12:27: error: 'class UART' has no member named 'baud'
if (last_baud != Serial.baud()) {
^~~~
C:\Users\kurte\Documents\Arduino\R4-Uno-wifi\USB_Serial_Test_change_baud\USB_Serial_Test_change_baud.ino:13:24: error: 'class UART' has no member named 'baud'
last_baud = Serial.baud();
^~~~
exit status 1
With a simple sketch I showed that the MINIMA (or WIFI in HID mode) has a very significant advantage over the WIFI when it comes to Serial USB throughput.