Page 1 of 1
XIAO ESP32 S3 Serial Setting with Even Parity
Posted: Wed Jan 24, 2024 8:28 am
by raymond25
Hi, I have an XIAO ESP32 S3 board and Iwould like to enquire how to set the serial port with SERIAL_8E1 in Arduino IDE, it's first seem to me a simple job as I can set it in ESP32CAM as Serial.begin(115200, SERIAL_8E1), but, when I changed the Board type to "XIAO_ESP32S3" in the IDE, this function did not accept two parameters!
Note: I had tried to change the board type in the Arduino IDE like ESP32S3 CAM LCD, but it does not work even the compilation passed.
Re: XIAO ESP32 S3 Serial Setting with Even Parity
Posted: Thu Jan 25, 2024 4:09 am
by lbernstone
Please post code and the compiler error
Re: XIAO ESP32 S3 Serial Setting with Even Parity
Posted: Thu Jan 25, 2024 12:37 pm
by raymond25
Hi, the error can be simply inputted as shown:
#include "Arduino.h"
void setup() {
// put your setup code here, to run once:
Serial.begin(115200, SERIAL_8E1);
}
void loop() {
// put your main code here, to run repeatedly:
}
Here is the error:
C:\Users\send2\AppData\Local\Temp\.arduinoIDE-unsaved2024025-19796-bkeync.38qx\sketch_jan25a\sketch_jan25a.ino: In function 'void setup()':
C:\Users\send2\AppData\Local\Temp\.arduinoIDE-unsaved2024025-19796-bkeync.38qx\sketch_jan25a\sketch_jan25a.ino:6:32: error: no matching function for call to 'HWCDC::begin(int, SerialConfig)'
Serial.begin(115200, SERIAL_8E1);
^
In file included from C:\Users\send2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/HardwareSerial.h:53,
from C:\Users\send2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/Arduino.h:184,
from C:\Users\send2\AppData\Local\Temp\.arduinoIDE-unsaved2024025-19796-bkeync.38qx\sketch_jan25a\sketch_jan25a.ino:1:
C:\Users\send2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/HWCDC.h:55:10: note: candidate: 'void HWCDC::begin(long unsigned int)'
void begin(unsigned long baud=0);
^~~~~
C:\Users\send2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\cores\esp32/HWCDC.h:55:10: note: candidate expects 1 argument, 2 provided
exit status 1
Compilation error: no matching function for call to 'HWCDC::begin(int, SerialConfig)'
Re: XIAO ESP32 S3 Serial Setting with Even Parity
Posted: Thu Jan 25, 2024 4:52 pm
by lbernstone
Ok, so that is saying that your Serial object is connected to the USB-CDC. USB doesn't have any concept of parity/stop bits (or even baud, really), so it is not possible to change it in this case.
Re: XIAO ESP32 S3 Serial Setting with Even Parity
Posted: Thu Jan 25, 2024 11:20 pm
by raymond25
Yes, this is my description, and so I asked for alternation of any possible system setup method.
And I really wish the Espressif will consider to extend the overloading of the method Serial.begin( ) as it is a too narrow function for XIAO S3.
Re: XIAO ESP32 S3 Serial Setting with Even Parity
Posted: Thu Jan 25, 2024 11:37 pm
by raymond25
Further information of my question, is that I just want the TX port (pin) of the XIAO to be even parity and not its USB Serial emulation.
Re: XIAO ESP32 S3 Serial Setting with Even Parity
Posted: Fri Jan 26, 2024 11:20 am
by lbernstone
Serial is an object owned by arduino. When you choose "Enable CDC on Boot", it is attached to the USB-CDC. You cannot set the parity on this.
The data coming across on uart0 is then managed by the esp-idf driver, and is attached to the console (STDOUT). If you want to receive that console data at different settings, you would need to modify the esp-idf settings:
Code: Select all
uart_set_parity(UART_NUM_0, UART_PARITY_EVEN);
There is no way to change the parity setting until setup runs, so you will miss the initial boot logging if your receiver is fixed on 8E1.
Re: XIAO ESP32 S3 Serial Setting with Even Parity
Posted: Fri Jan 26, 2024 12:36 pm
by raymond25
Ok, thanks for your advice.