I can't change the baud rate :(

Hello :slightly_smiling_face:

I’m trying to use my DOIT Esp32 Devkit v1 to manage a GPS module and a Nextion display. Therefore, I need two serial ports at baud rate = 9600. My code so far:

import streams

gps = streams.serial(SERIAL0,set_default=False,baud=9600)
display = streams.serial(SERIAL1,set_default=False,baud=9600)

while True:
gps.write(“Hello World”)

I already tried to use print(“Hello World”,stream=gps).

I only can read the output if my terminal was configured with 115200. With 9600, I get wrong data (like “þÖÝ”).

How can I change the baud rate? What I doing wrong? :thinking: Is this related to serial-USB chip on my board?

Best regards,

Since Serial0 is connected to the USB-to-UART bridge IC on this board, It is used for the serial monitor, so the Buadrate is probably hard-coded somewhere to be 115200 to be suitable for the serial monitor.

As a quick solution for your activities, You can use serial0 for the serial monitor with buadrate=115200 and use the other two UART instances, serial1 and serial2, for the GPS and Nextion displays.

In otherwords, you can connect the GPS module and the Nextion display to Serial1 and Serial2 with whatever baudrate you’d like, and use Serial0 for the serial monitor with baud=115200.

If you have more questions, feel free to ask.:smile:

1 Like

Hello @karimhamdy1. Thank you for the help :slight_smile:

I realized that the problem is the UART-USB IC, and I’m using the other two ports, as you recommended. :smiley: