XIAO ESP32 S3 Serial Setting with Even Parity

raymond25
Posts: 5
Joined: Wed Jan 24, 2024 5:19 am

XIAO ESP32 S3 Serial Setting with Even Parity

Postby raymond25 » Wed Jan 24, 2024 8:28 am

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.

lbernstone
Posts: 673
Joined: Mon Jul 22, 2019 3:20 pm

Re: XIAO ESP32 S3 Serial Setting with Even Parity

Postby lbernstone » Thu Jan 25, 2024 4:09 am

Please post code and the compiler error

raymond25
Posts: 5
Joined: Wed Jan 24, 2024 5:19 am

Re: XIAO ESP32 S3 Serial Setting with Even Parity

Postby raymond25 » Thu Jan 25, 2024 12:37 pm

Hi, the error can be simply inputted as shown:

  1. #include "Arduino.h"
  2.  
  3.  
  4. void setup() {
  5.   // put your setup code here, to run once:
  6. Serial.begin(115200, SERIAL_8E1);
  7. }
  8.  
  9. void loop() {
  10.   // put your main code here, to run repeatedly:
  11.  
  12. }

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)'

lbernstone
Posts: 673
Joined: Mon Jul 22, 2019 3:20 pm

Re: XIAO ESP32 S3 Serial Setting with Even Parity

Postby lbernstone » Thu Jan 25, 2024 4:52 pm

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.

raymond25
Posts: 5
Joined: Wed Jan 24, 2024 5:19 am

Re: XIAO ESP32 S3 Serial Setting with Even Parity

Postby raymond25 » Thu Jan 25, 2024 11:20 pm

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.

raymond25
Posts: 5
Joined: Wed Jan 24, 2024 5:19 am

Re: XIAO ESP32 S3 Serial Setting with Even Parity

Postby raymond25 » Thu Jan 25, 2024 11:37 pm

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.

lbernstone
Posts: 673
Joined: Mon Jul 22, 2019 3:20 pm

Re: XIAO ESP32 S3 Serial Setting with Even Parity

Postby lbernstone » Fri Jan 26, 2024 11:20 am

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.

raymond25
Posts: 5
Joined: Wed Jan 24, 2024 5:19 am

Re: XIAO ESP32 S3 Serial Setting with Even Parity

Postby raymond25 » Fri Jan 26, 2024 12:36 pm

Ok, thanks for your advice.

Who is online

Users browsing this forum: No registered users and 187 guests