Execute a predefined set of codes after the page is switched in Dwin Display

Looking at the code structure of post #1, it is my observation that the OP has done copy/paste!!

What logic conversion between the 5v display and the 3.3v inputs of the esp32 is happening?

sure, Shall do it.

shall look into it. thanks for the info.

I need some time to answer all your questions, as I'm traveling can I come back in 2-3 days?
Hope you won't mind?

Thank you! Take your time.

@giritime,

I have merged your 3 topics. While they might be different questions they are all clearly about the same project and the information from one question is relevant to the next. Please do not create any more separate topics about this project, just keep adding to this one.

Thank you.

sure thank you

Hi I'm having a simple doubt.
Is it possible to identify whether the data that is coming from serial port is UART or I2C protocol?

If I were you, I'd use an oscilloscope to check the comm lines:

UART would something like this look like this (applicable to both rx and tx lines):
image

I2C has a clock and serial line and would look respectively something like this:
image

hope that helps...

2 Likes

Hello Sherzaad,
Thanks for the reply,
I mean to say the data that is coming in serial monitor.
Because I have two devices (slaves) connected to my ESP32, one is connected via UART and other is connected via I2C. Both these devices (slaves) are sending data at a time and I'm interested in reading data that is coming from UART.

Which "serial port" do you have in mind?

I2C bus has SCL and SDA lines which have NPN drivers with pullup resistors. On such lines you can change the default HIGH level by connecting a resistor (560-1k) to GND.

A UART by itself has an input (RX) and output (TX) line. With a peer connected both lines are outputs. Voltage does not change when you connect a 1k resistor.

There exists one more protocol: USART has both RX/TX and a clock line.

Then it depends on the ESP code which of the inputs is echoed to Serial Monitor. It can be none, one or both input channels.

Data is sent from both devices at the same time, but I'm interested in reading UART data.

could you share a block diagram detailing to what pins those devices are connected to on the ESP32 please?

1 Like

.. and it mus be received in your sketch. And it mus explicitly sent to the serial monitor in your sketch. This doesn't happen from itself. So you know where you received the data from, and which data you sent to the serial monitor.

Sure, Here is my wiring details
image

Could please let me know how to segregate the data that is coming from UART serial?

The I2C Bus is clear in its schematic,
but ESP32 has 3 UARTs.
Which UART do you want to read the data? UART 2 (TX2 RX2)?
On UART 1 you have the serial monitor.

If so, separate the data coming from I2C or UART2,
will it be done by your code?

It's still not very clear what is it you actually are trying to solve...

if Data is from UART (ie Serial2 based no the schem you shared) then use:

Serial2.Avaialble()

to check if you have/are receiving any UART data.

if Data is from I2C, then

Wire.requestFrom(addr, n); // request 'n' bytes from peripheral device address 'addr'

while (Wire.available()) { //check if i2c data is being receive from periperal

  char c = Wire.read(); // receive a byte as character
  //do something with received byte

}

U can looks up online those functions if you are not familiar with them.

hope that helps...