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

Serial2 initialization on ESP32-WROOM-32E causes reinitialization of digital pin 4 #9728

Closed
1 task done
CalamaroGigante opened this issue May 30, 2024 · 3 comments
Closed
1 task done
Assignees
Labels
3.0 migration issue relates to migration from 2.X to 3.X version Peripheral: UART Status: Solved Type: For reference Common questions & problems Type: Question Only question

Comments

@CalamaroGigante
Copy link

Board

Firebeetle v1

Device Description

Development board

Hardware Configuration

Serial2 initializing

Version

v3.0.0

IDE Name

Arduino IDE 2.3.2

Operating System

Windows 10

Flash frequency

?

PSRAM enabled

yes

Upload speed

115200

Description

Initializing Serial2 causes IO4 to be set to HIGH, and it is impossible to control via digitalWrite, unless reinitialized
A rollback to previous revision solves the issues

Sketch

#include <Arduino.h>


#define PIN_ENABLE_HOHC 4


void setup() 
{
  pinMode(PIN_ENABLE_HOHC, OUTPUT);// Set as output mode 
  digitalWrite(PIN_ENABLE_HOHC, LOW);   
  Serial.begin(115200);
  Serial.println("First");
  delay(5000);
  Serial2.begin(9600);  //this instruction causes digital pin 4 to go HIGH
  Serial.println("Second");
  delay(5000);
}

void loop() 
{
  pinMode(PIN_ENABLE_HOHC, OUTPUT);//Still high
  digitalWrite(PIN_ENABLE_HOHC, LOW);   
}

Debug Message

Compiles OK, no errors.

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@CalamaroGigante CalamaroGigante added the Status: Awaiting triage Issue is waiting for triage label May 30, 2024
@CalamaroGigante
Copy link
Author

#include <Arduino.h>

#define PIN_ENABLE_HOHC 4

void setup()
{
pinMode(PIN_ENABLE_HOHC, OUTPUT);// Set as output mode
digitalWrite(PIN_ENABLE_HOHC, LOW);
Serial.begin(115200);
Serial.println("First");
delay(5000);
Serial2.begin(9600); //this instruction causes digital pin 4 to go HIGH
Serial.println("Second");
delay(5000);
}

void loop()
{
//pinMode(PIN_ENABLE_HOHC, OUTPUT); if this instruction is commented
digitalWrite(PIN_ENABLE_HOHC, LOW); //this one does not work
}

@SuGlider SuGlider added Type: For reference Common questions & problems Type: Question Only question Peripheral: UART 3.0 migration issue relates to migration from 2.X to 3.X version Status: Solved and removed Status: Awaiting triage Issue is waiting for triage labels May 30, 2024
@SuGlider
Copy link
Collaborator

@CalamaroGigante - Arduino Core 3.0.0 and 2.0.15+ has changed ESP32 Serial2 pins to RX = GPIO4 and TX = GPIO25.
This is the reason for this issue. Please check PR# #8800

In order to use GPIO4 and Serial2, please initialize it using the call:
Serial2.begin(baud_rate, uart_mode, RX2_pin, TX2_pin);

Based on your example code: Serial2.begin(9600, SERIAL_8N1, RX2_pin, TX2_pin);

New Pins:

Name ESP32 S2 S3 C3 C6 H2
UART0 RX SOC_RX0 3 44 44 20 17 23
UART0 TX SOC_TX0 1 43 43 21 16 24
UART1 RX RX1 26 4 15 18 4 0
UART1 TX TX1 27 5 16 19 5 1
UART2 RX RX2 4 -- 19 -- -- --
UART2 TX TX2 25 -- 20 -- -- --

@VojtechBartoska
Copy link
Contributor

I am closing this as answered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0 migration issue relates to migration from 2.X to 3.X version Peripheral: UART Status: Solved Type: For reference Common questions & problems Type: Question Only question
Projects
None yet
Development

No branches or pull requests

3 participants