ESP32 Gateway Rev G - Hardware Serial Problem

Started by saschab, November 19, 2021, 02:08:28 AM

Previous topic - Next topic

saschab

Hello,

i have a ESP32-Gateway-EA Board Rev G Board and want to use the GPIO4 and GPIO36 as Hardware Serial1 Pins (4 as TX1 and 36 as RX1). So in the adruino_pins.h file they are not declared only TX and RX so I define TX1 and RX1 in my Code.
I use Serial1.begin(115200, SERIAL_8N1, RX1, TX1); to initialize the Serial1 with my defined Pins but this didn't work. The attached Serial Display wouldn't work.
I have also a ESP32-POE-ISO board which working without problems in the same Configuration.
Do you have an idea why that wouldn't work?
As per ESP documentation the Pin Config can be free choosen, and the GPIO4 and 36 are free to use as described in the Olimex Documentation.

Thx and Regards
Sascha

LubOlimex

GPIO4 seems to be wired differently between these boards. In ESP32-GATEWAY it is connected to the SD card, being a DATA signal. Do you have SD card inserted when you test? Can you remove the card and test again?

If you don't have an SD card inside the board and the problem remains then it should be probably a software configuration issue.
Technical support and documentation manager at Olimex

saschab

Hi,

Thx for the reply. No i have bo se card in use.
Do you have an idea what configuration could be wrong as i initialize the serial with the above statement.

Rgds
Sascha

LubOlimex

Paste the full code that you use for Serial1. Use the code code /code tags in brackets.
Technical support and documentation manager at Olimex

saschab

Hi,

here is the code :

plattformio.ini
build_flags = -D ARDUINO_ESP32_GATEWAY=71

pins_adruino.h
#if ARDUINO_ESP32_GATEWAY >= 'D'
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
#define ETH_PHY_POWER 5
#endif
static const uint8_t TX1 = 4;
static const uint8_t RX1 = 36;


main.cpp

EasyNex nDisplay(Serial1); // Create an object of EasyNex class with the name  "myNex" 

void setup() {
Serial1.begin(115200, SERIAL_8N1, RX1, TX1); 
nDisplay.begin(115200);
delay(500); // To Allow Display to init and Serial to init Switch
nDisplay.writeStr("page page0");
delay(50);
};


hope that helps :-)

Rgds
Sascha

LubOlimex

#5
Your code seems fine. It is also not related to the hardware design of the boards because our tests don't show any issues (tests detailed at the end of this post).

Maybe double check your hardware connections, maybe your wiring is lose or wrong. It is not clear if the platformIO file is correct or if the libraries are correct.

We did a simple bridge test here with ESP32-GATEWAY but used Arduino IDE just to confirm if there is any issue with these pins from design point of view. It is just sending data between USB and serial1 and the other way and it works fine. This excludes design problems. I will share it here:

static const uint8_t TX1 = 4;
static const uint8_t RX1 = 36;

void setup()
{
  Serial.begin (115200);
  Serial1.begin(115200, SERIAL_8N1, RX1, TX1);
}

void loop()
{
  if (Serial.available () > 0)
    Serial1.print ((char)Serial.read());
  if (Serial1.available () > 0)
    Serial.print ((char)Serial1.read());
}

Maybe to debug the issue also try with Arduino IDE, this would exclude issues related to platformIO.
Technical support and documentation manager at Olimex

saschab

Hi,

thx for this i tried it and it worked. So i dig more deep based on this and found the "Problem" seems that the "default" settings for Serial1 didn't work same on the POE-ISO and the Gateway so after i added the configuration settings explicity on display init in the gateway code it works like a charm.

Thx for the fast and professional help.

Have a good day.

Best Regards
Sascha

LubOlimex

Thank you for the update, glad I was able to help.
Technical support and documentation manager at Olimex