Serial on Adafruit ESP32-S2 TFT Feather

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
williamgill
 
Posts: 4
Joined: Mon Jul 08, 2019 9:55 am

Serial on Adafruit ESP32-S2 TFT Feather

Post by williamgill »

I have a Adafruit ESP32-S2 TFT Feather that I'd like to use to control a DRA818 radio. The serial didn't seem to be working so I tried a loop back demo, this also doesn't seem to work. Is there something special about this board (are the serial ports already in use by the neo pixel and the TFT?). Below complies and spits out "test" every 3 seconds.

Code: Select all

#include <HardwareSerial.h>

HardwareSerial S2(1);
HardwareSerial S3(2);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  S2.begin(9600, SERIAL_8N1, 9, 10);  //tx, rx
  S3.begin(9600, SERIAL_8N1, 11, 12);
}

void loop() {
      delay(3000);
      Serial.println("test");
      S3.write("hello");
      while(S2.available()){
        char RxChar = S2.read();
        Serial.print(RxChar);
      } 

}
 

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: Serial on Adafruit ESP32-S2 TFT Feather

Post by adafruit_support_carter »

I've reproduced this and think it's an issue with the ESP32 core define for this board. Fixing that will require some flow time to get the changes into the ESP32 core.

As a temporary workaround, can manually configure Serial1 on the TX RX pins using:

Code: Select all

  Serial1.begin(9600);
  Serial1.setPins(2, 1);
in setup().

Here's a complete example sketch that should generate some simple output:

Code: Select all

int count = 0;

void setup() {
  Serial1.begin(9600);
  Serial1.setPins(2, 1);
}

void loop() {
  Serial1.println(count++);
  delay(500);
}
NOTE it's Serial1, not Serial. Serial is what goes over the USB port, which is not the same as the TX/RX pins.

User avatar
williamgill
 
Posts: 4
Joined: Mon Jul 08, 2019 9:55 am

Re: Serial on Adafruit ESP32-S2 TFT Feather

Post by williamgill »

Perfect! I used .setPins and am now talking to the radio as expected. I had never seen .setPins anywhere before, thank you for setting me in that direction.

User avatar
hathach
 
Posts: 1270
Joined: Tue Apr 23, 2013 1:02 am

Re: Serial on Adafruit ESP32-S2 TFT Feather

Post by hathach »

we made an PR to fix this and merged to arduino-esp32. This issue should be fixed in the next arduino-esp32 core release https://github.com/espressif/arduino-esp32/pull/7680.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”