Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: xiao esp32s3 serial1 #1442

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ Before we begin, let's review all the pins that the XIAO ESP32S3 has and its fun
</tr>
</table>


- 5V - This is 5v out from the USB port. You can also use this as a voltage input but you must have some sort of diode (schottky, signal, power) between your external power source and this pin with anode to battery, cathode to 5V pin.

- 3V3 - This is the regulated output from the onboard regulator. You can draw 700mA
Expand Down Expand Up @@ -505,6 +504,49 @@ After uploading the program, open the Serial Monitor in Arduino IDE and set the

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/SeeedStudio-XIAO-ESP32S3/img/24.png" style={{width:600, height:'auto'}}/></div>

### UART Serial
Jasionf marked this conversation as resolved.
Show resolved Hide resolved

According to the above XIAO-S3 Pin diagrams for specific parameters,we can observe that there are TX pin and RX pin,This is different from serial communication, but the usage is also very similar, except that a few parameters need to be added,So nex,we will use the pins led out by the chip for serial communication
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

名字要写正确,XIAO ESP32S3


Core Function that need to be include:

- `Serial1.begin(BAUD,SERIAL_8N1,RX_PIN,TX_PIN);` -- enalbe Serial1,the function prototype : `<Serial.Type>.begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin);`
- `baud` :badu rate
- `config`:Configuration bit
- `rxPin` :Receive Pin
- `txPin` :Send Pin

It is worth nothing that if we use digital pin port to define,this place should be`#define RX_PIN D7`、`#define TX_PIN D6`,if we use GPIO pin port to define,this place should be `#define RX_PIN 44`、`#define TX_PIN 43`,please refer to the pin diagrams of different XIAO Series for specific parameters

Here is an example program:

```c
#define RX_PIN D7
#define TX_PIN D6
#define BAUD 115200


void setup() {
Serial1.begin(BAUD,SERIAL_8N1,RX_PIN,TX_PIN);
while(!Serial1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

去掉

}

void loop() {
if(Serial1.available() > 0)
{
char incominByte = Serial1.read();
Serial1.print("I received : ");
Serial1.println(incominByte);
}
delay(1000);
}
```

After uploading the program, open the Serial Monitor in Arduino IDE and set the baud rate to 115200. You will see the following message on the serial monitor, which outputs 'Hello Everyone!' every second. Also, you can send content to the XIAO ESP32S3 through the serial monitor, and XIAO will print out each byte of the content you send.

<div style={{textAlign:'center'}}><img src="https://files.seeedstudio.com/wiki/SeeedStudio-XIAO-ESP32S3/img/114.png" style={{width:600, height:'auto'}}/></div>


### Usage of Software Serial

If you feel that one hardware serial port is not enough, you can also use the ESP32's software serial function to set some pins as software serial to expand the number of serial ports.
Expand Down Expand Up @@ -597,7 +639,7 @@ void setup()
MySerial0.print("MySerial0");

// And configure MySerial1 on pins RX=D9, TX=D10
MySerial1.begin(115200, SERIAL_8N1, 8, 9);
MySerial1.begin(115200, SERIAL_8N1, 9, 10);
MySerial1.print("MySerial1");
}

Expand Down
Loading