Arduino Mega pms3003, bme280 and w5100

I use ethernet shield mounted on Arduino mega 2560. I connected BME280. Everything works great. When I connect pms3003 with KAmodLVC there is no data from this sensor. I tried to connect rx and tx to all pins marked as rx and tx on Mega and ethernet shield.
If I connect pms3003 to Arduino Uno it works correct.
This is my code:

#include <BME280I2C.h>
#include <Ethernet.h>
#include <MySQL_Connection.h>
#include <Dns.h>
#include <MySQL_Cursor.h>
#include <Wire.h>
#include <EnvironmentCalculations.h>
#include <stdio.h>
#include <PMS.h>
#define N 23

BME280I2C bme;

byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char t[8] = "";
char hostname[] = "0000000"; // change to your server's hostname/URL
char user[] = "00000000";               // MySQL user login username
char password[] = "0000000";         // MySQL user login password
char INSERT_DATA[] = "INSERT INTO base.ruchLog (ruch1, hum, pres) VALUES (%s,%s,%s)";
char query[128];
char temperature[10];
char wilgotnosc[10];
char cisnienie[10];
//PMS
char linia1[16], linia2[16];
String sumPM25, sumPM10;
unsigned char bufor [N];
int PM25 = 10, PM10 = 10;
int wartoscPM25(unsigned char *thebuf);
int wartoscPM10(unsigned char *thebuf);
char sprawdzLancuch(unsigned char *thebuf, char leng);


IPAddress server_ip;
EthernetClient client;
MySQL_Connection conn((Client *)&client);
DNSClient dns_client;   // DNS instance

void setup() {
  Serial.begin(115200);
  //while (!Serial); // wait for serial port to connect
  Wire.begin();
  //delay(1000);
    // Nadawanie MAC 
   Ethernet.begin(mac_addr);
   Serial.println(Ethernet.localIP());
  // Begin DNS lookup
  dns_client.begin(Ethernet.dnsServerIP());
  dns_client.getHostByName(hostname, server_ip);
  Serial.println(server_ip);
  // End DNS lookup

  if(!bme.begin()) {
      Serial.println("Could not find the BME280 Sensor, check wiring"); 
      while (1);
  }
    // bme.chipID(); // Deprecated. See chipModel().
  switch(bme.chipModel())
  {
     case BME280::ChipModel_BME280:
       Serial.println("Found BME280 sensor! Success.");
      break;
     case BME280::ChipModel_BMP280:
       Serial.println("Found BMP280 sensor! No Humidity available.");
       break;
     default:
       Serial.println("Found UNKNOWN sensor! Error!");
  }

  connecting();
}

void connecting(){
Serial.println("Connecting...");
delay(1000);
  if (conn.connect(server_ip, 3306, user, password)) {
    delay(1000);
  }
  else{
    Serial.println("Not Connected.");
    conn.close();
  }
}

void loop() {
  printBME280Data(&Serial);
   //delay(500);
  
}

void printBME280Data
(
   Stream* client
)
{
   
   float temp(NAN), hum(NAN), pres(NAN), tempAVG, humAVG, presAVG;

   BME280::TempUnit tempUnit(BME280::TempUnit_Celsius);
   BME280::PresUnit presUnit(BME280::PresUnit_hPa);
   tempAVG=0; humAVG=0;presAVG=0;sumPM25="";sumPM10="";
   for (int a=0; a<10; a++) //co 10 minut zapis do mysql
{
  bme.read(pres, temp, hum, tempUnit, presUnit);

   client->print("Temperatura: ");
   client->print(temp);
   client->print("°"+ String(tempUnit == BME280::TempUnit_Celsius ? 'C' :'F'));
   client->print("\t\tWilgotność: ");
   client->print(hum);
   client->print("% RH");
   client->print("\t\tCiśnienie: ");
   client->print(pres);
   client->println(" hPa\t\t");
   tempAVG+=temp;
   humAVG+=hum;
   presAVG+=pres;
   //for (int b=0; b<12; b++) // co 5 sekund sprawdzenie czujnika
   // {
      if(Serial.find(0x42))    
    Serial.readBytes(bufor,N);

     if(bufor[0] == 0x4d){
      if(sprawdzLancuch(bufor,N)){  
        PM25=wartoscPM25(bufor);
        PM10=wartoscPM10(bufor);  
     }
    }
   sprintf(linia1,"%d",PM25);
   Serial.print(linia1);
   sprintf(linia2,"%d",PM10);
   Serial.println(linia2);
   //Serial.println(sumPM25=sumPM25 + "|" + linia1);
   //Serial.println(sumPM10=sumPM10 + "|" + linia2);
   //delay(5000);
   //}
   delay(60000);
}
    MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);
    // Save
    dtostrf(tempAVG/10, 1, 3, temperature);
    dtostrf(humAVG/10, 1, 3, wilgotnosc);
    dtostrf(presAVG/10, 1, 2, cisnienie);
    sprintf(query, INSERT_DATA, temperature, wilgotnosc, cisnienie);
    // Execute the query
    cur_mem->execute(query);
    // Note: since there are no results, we do not need to read any data
    // Deleting the cursor also frees up memory used
    delete cur_mem;
    Serial.println("Dane zapisane.");
  //delay(300000);
}

int wartoscPM25(unsigned char *buf) // generacja wartosci PM2,5
{
  int PM25v;
  PM25v=((buf[11]<<8) + buf[12]);  
  return PM25v;
}

int wartoscPM10(unsigned char *buf) // generacja wartosci PM10
{
  int PM10v;
  PM10v=((buf[13]<<8) + buf[14]); 
  return PM10v;
}

bool sprawdzLancuch(unsigned char *buf, int dlugosc) // sprawdzenie poprawności lancucha
{  
  bool flaga=0;
  int suma=0;

  for(int i=0; i<(dlugosc-2); i++){
  suma+=buf[i];
  }
 suma=suma + 0x42;
 
  if(suma == ((buf[dlugosc-2]<<8)+buf[dlugosc-1]))  
  {
    suma = 0;
    flaga = 1;
  }
  return flaga;
}

I dont know where I should connect RX and TX cables to start get data from PMS. BME280 is connected to 20 and 21. I checked these pins too.

This code works with Uno but dont works with Mega. Why?

/*
 * 
 * 
 */

#include <stdio.h>
#include <PMS.h>
#define N 23

char linia1[16], linia2[16];
String sumPM25, sumPM10; 
unsigned char bufor [N];
int PM25 = 10, PM10 = 10;
int wartoscPM25(unsigned char *thebuf);
int wartoscPM10(unsigned char *thebuf);
char sprawdzLancuch(unsigned char *thebuf, char leng);
int a=0;
void setup(){
   Serial.begin(9600);
   
}
 
void loop(){
  if(Serial.find(0x42))    
    Serial.readBytes(bufor,N);

     if(bufor[0] == 0x4d){
      if(sprawdzLancuch(bufor,N)){  
        PM25=wartoscPM25(bufor);
        PM10=wartoscPM10(bufor);  
     }
    }
    
   sprintf(linia1,"%d",PM25);
  
   Serial.print(linia1);
   
   sprintf(linia2,"%d",PM10);
   
   Serial.println(linia2);
   Serial.println(sumPM25=sumPM25 + "|" + linia1);
   Serial.println(sumPM10=sumPM10 + "|" + linia2);
   Serial.println(a++);
   if (a==10){sumPM25="";sumPM10="";a=0;}
   delay(1000);
}

int wartoscPM25(unsigned char *buf) // generacja wartosci PM2,5
{
  int PM25v;
  PM25v=((buf[11]<<8) + buf[12]);  
  return PM25v;
}

int wartoscPM10(unsigned char *buf) // generacja wartosci PM10
{
  int PM10v;
  PM10v=((buf[13]<<8) + buf[14]); 
  return PM10v;
}

bool sprawdzLancuch(unsigned char *buf, int dlugosc) // sprawdzenie poprawności lancucha
{  
  bool flaga=0;
  int suma=0;

  for(int i=0; i<(dlugosc-2); i++){
  suma+=buf[i];
  }
 suma=suma + 0x42;
 
  if(suma == ((buf[dlugosc-2]<<8)+buf[dlugosc-1]))  
  {
    suma = 0;
    flaga = 1;
  }
  return flaga;
}

It does not work

sotb:
I tried to connect rx and tx to all pins marked as rx and tx on Mega and ethernet shield.

Didn't look at anything else in your post, but never connect anything to the TX/RX pins of a Mega.
Use one of the OTHER THREE hardware serial pairs of the Mega (pin14-19).
Leo..

It is very precious information for me. You pointed me I schould focus my brain to find what is the name of other three serials. So I read some other examples and understand I need to add line:

Serial2.begin(9600); //in void setup

and change Serial to Serial2:

void loop(){
  if(Serial2.find(0x42))    
    Serial2.readBytes(bufor,N);
(...)

So you helped me to find solution for Arduino MEGA. Thank you.

Similar situation I have with D1 R2 ESP8266 32M board. Data is coming about 30 seconds, and later data is allways the same as the last and nothing changes. But I have only one serial TX/RX on this board.
I decided to use SoftwareSerial on D2 and D3 pins and it works, but values given by PMS3003 are to high I think. 38 for PM2,5 and 46 for PM10 in my room. Unbelievable.