A weird serial port problem Arduino GIGA (EasyNextionLibrary)

I am using the EasyNextionLibrary in my GIGA board. There is a problem and I still can't solve it.

I connect Arduino GiGA to the computer via Type C. Data is transmitted properly to the Nextion display. However, we remove the Type C cable and when we run the display and GIGA through the PCB board we designed, the data freezes and is not transmitted. Could this be due to Serial numbering in GIGA? Connected to Nextion TX2 and RX2. Therefore, it is initialized as Serial3.begin(9600). However, when I remove the Type C cable, data is not transmitted when RX and TX, that is, Serial.begin, are disabled. What could be the reason for this?

The lines of code are as follows...


#include "EasyNextionLibrary.h"  // Include EasyNextionLibrary
EasyNex myNex(Serial3); // Giga'daki RX2 TX2 pinine bağlı.   17(RX2), 16(TX2) --> Serial3 

String duman_okunan=""; // String türünde bir adet değişken tanımlanıyor
int duman = A0; // analog pin 0 MQ2 yi okuyor 

#include "RPC.h"

void setup() {

  RPC.begin();   
  myNex.begin(9600);    

  //M7 işlemcide hizDeger fonksiyonunu bağlıyoruz.
  RPC.bind("hizDeger", hizDeger);
  myNex.writeStr("page page0");
 Serial.begin(9600);
}

void loop() {

//Duman Sensörü okuma ve Nextion HMI Ekrana Yazdırma
myNex.writeNum("dumanN.val", duman_oku()); 

Serial.println(duman_oku());  
  String hizSon = "";
  while (RPC.available()) {
    hizSon += (char)RPC.read();  // Fill the buffer with characters
  }
  if (hizSon.length() > 0) {
    //Serial.print(hizSon);
    int hizYazdir = hizSon.toInt();
    myNex.writeNum("km.val", hizYazdir);   //Nextion'a hızın verisini gönderiyoruz.     
    delay(10);
  }
 int hizDeger(int hiz) {  
   delay(3);
   return hiz;  
}
double duman_oku()    //Duman sensörü için fonksiyon tanımladık
{
  double duman_bilgi = analogRead(duman);  
  return duman_bilgi;
}

You seem to have correctly sorted out the pins and serial instances.

Sounds to me like an issue with the board you have designed. Is the ground connection between the Nextion and the Giga solid on that board

Yes, I just checked it with a Multimeter. There is a ground connection on the board with the Nextion GND pin. As soon as you plug the Type C cable into the computer, the data appears on the screen. Arduino Mega was previously running on this board. I adapted all the codes for GIGA. But unfortunately I can only see the sensor data when the cable is plugged in.

Hi @kaanrevan.

That code won't compile. Please post the code that is actually running on the GIGA R1 WiFi board when the problem occurs.