Using IO10, IO9 for UART1 on ESP32-PICO-D4

techtoys
Posts: 28
Joined: Sat Jun 01, 2019 11:11 am

Using IO10, IO9 for UART1 on ESP32-PICO-D4

Postby techtoys » Tue Oct 25, 2022 6:58 am

Hi

I am trying to use UART1 (IO9=U1RXD, IO10=U1TXD) on ESP32-PICO-D4. It is stated on the datasheet that only IO16,17, CMD, CLK, SD0, and SD1 cannot are used for embedded flash so I thought IO9 and IO10 would be "OK" for UART1.

When I try to use SoftwareSerial on IO9 and IO10, these pins do not perform as UART but the other pins (e.g. IO23=UnRXD, IO18=UnTXD) work perfectly.

Can I actually use IO9, 10 as UART1 on ESP32-PICO-D4?

John

techtoys
Posts: 28
Joined: Sat Jun 01, 2019 11:11 am

Re: Using IO10, IO9 for UART1 on ESP32-PICO-D4

Postby techtoys » Tue Oct 25, 2022 8:50 am

Correction.

After a careful wiring, I can assure that SoftwareSerial and HardwareSerial work for IO9 and IO10.
Listing below shows the code:

Code: Select all

#include <HardwareSerial.h>

const byte rxPin = 9;  //IO18 working too
const byte txPin = 10; //IO23 working too

void onReceiveCallback(void);
int counter = 0;

void setup() {
  // put your setup code here, to run once:
  Serial1.begin(57600, SERIAL_8N1, rxPin, txPin);
  delay(500);
  Serial1.onReceive(onReceiveCallback); 
}

void loop() {

  // put your main code here, to run repeatedly:
  Serial1.print("HardwareSerial Hello counter : "); Serial1.println(counter++, DEC);
  delay(1000);
}

///callback fcn on UART receive
void onReceiveCallback(void)
{
  Serial1.println("Hardware UART callback fcn ok!");
}
The same code works with

Code: Select all

#include <SoftwareSerial.h>
too.

Thank you.

John

Who is online

Users browsing this forum: Google [Bot] and 114 guests