-
Notifications
You must be signed in to change notification settings - Fork 331
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
Implementing UART connection #47
Comments
Found the solution to my own issue, This is a comment from banggood that has helped me: A "standard" ESP32 has more pins, the default pins are 3 (Rx) and 1 (Tx) for Serial(0), 9 (Rx) and 10 (Tx) for Serial1, and 16 (Rx) and 17 (Tx) for Serial2. As you can see, with the limited number of pins on this TTGO board, none of them are there. But the good news is that the "Serial.begin" function has an option to change the pins! By using "Serial2.begin(9600, SERIAL_8N1, 25, 26);" you have the Serial2 port on pins 25 (Rx) and 26 (Tx). I tested this today, it's working like a charm!. It's NOT working on pins 37 and 38 (and maybe other pins), but it IS working on pins 25, 26, 27 !!! |
Notice that GPIO pins 34 to 39 are input only, so they can be used for RX but not for TX. |
Please, There is a default pins to Serial2 or Serial1 on this board? I´m try to use it as MIDI controller using MIDI.h on IDE Arduino. However I dont get define this pins (25, 26 or 27) to Serial to be used by MIDI.h library. I try `struct Serial2MIDISettings : public midi::DefaultSettings }; MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial2, MIDI, Serial2MIDISettings);` but not works. Anybody could help me? Thanks |
Thanks for your comments, I had some issues about that, and this thread help me a lot. Only for extend and confirm this solution I put here my config, because also I have one MicroSD card reader and one UART GPS: // GPS UART pins definitions
#define GPS_TX 25
#define GPS_RX 26
// MicroSD card reader
#define SD_CS 2
#define SD_MISO 27
#define SD_MOSI 15
#define SD_CLK 13
// All peripherals enabler
#define HW_EN 33 |
I'm facing similar problems using the TTGO-T Display board when using MIDI, WiFi and the display. I can not use the display at the same time I use MIDI. The following part works (I know, defining Serial2 is reduntant) but the display stops when it is called. Anybody out there with a hint? I also use those libraries:
Andf this is the code:
|
Just used Serial and that works. So it seems the board (or one of the display libraries) use Serial1 and/or Serial2. This works for display AND DIN-serial-output: To keep my code (more or less) clean I set a link to
|
Hello, I get a TTGO LORA32, and has output pin for UART there is only GPIO 1 & 3 (used for USB serial). thanks |
Hello, it seems you reversed the TX and RX in your Serial2.begin command. It should be SerialPort2.begin (BaudRate, SerialMode, RX_pin, TX_pin). You'll find a tutorial on using the serial ports, including using alternative pins here : https://microcontrollerslab.com/esp32-uart-communication-pins-example/ |
Hello, I'm new to this.
With Arduino UNO, there are TX and RX pins for me to establish UART connection.
Which pins can I use to for TX and RX? Thanks.
The text was updated successfully, but these errors were encountered: