DHT22 showing timeout error when trying to display data on LCD

Hello,
I have been trying to display data from dht22 sensor to OPEN-SMART 3.2inch TFT LCD screen.
Ive uploaded image from sd card on screen to use as background, and tried to display data from dht22 over the image. It is successful only first time after the code is uploaded, then every reading after first one shows -999.0 for both humidity and temperature. The sensor works fine on its own when I display data just on serial monitor without trying to displayit on lcd (dht22 test code works normally that is). Ive put in error checker from dht22 test code and it seems that error that is occurring is dhtlib_timeout_error.
Does anyone know how I can solve that?

#include <SPI.h>
#include <SD.h>
#include <dht.h> 
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
dht DHT;
#define DHT22_PIN 53
#if defined(ESP32)
#define SD_CS     5
#else
#define SD_CS     5
#endif
#define NAMEMATCH ""
#define PALETTEDEPTH   0

char namebuf[32] = "/";

File root;
int pathlen;

#define BMPIMAGEOFFSET 54

#define BUFFPIXEL      20

uint16_t read16(File& f) {
    uint16_t result;         // read little-endian
    f.read((uint8_t*)&result, sizeof(result));
    return result;
}

uint32_t read32(File& f) {
    uint32_t result;
    f.read((uint8_t*)&result, sizeof(result));
    return result;
}

uint8_t showBMP(char *nm, int x, int y)
{
    File bmpFile;
    int bmpWidth, bmpHeight;    // W+H in pixels
    uint8_t bmpDepth;           // Bit depth (currently must be 24, 16, 8, 4, 1)
    uint32_t bmpImageoffset;    // Start of image data in file
    uint32_t rowSize;           // Not always = bmpWidth; may have padding
    uint8_t sdbuffer[3 * BUFFPIXEL];    // pixel in buffer (R+G+B per pixel)
    uint16_t lcdbuffer[(1 << PALETTEDEPTH) + BUFFPIXEL], *palette = NULL;
    uint8_t bitmask, bitshift;
    boolean flip = true;        // BMP is stored bottom-to-top
    int w, h, row, col, lcdbufsiz = (1 << PALETTEDEPTH) + BUFFPIXEL, buffidx;
    uint32_t pos;               // seek position
    boolean is565 = false;      //

    uint16_t bmpID;
    uint16_t n;                 // blocks read
    uint8_t ret;

    if ((x >= tft.width()) || (y >= tft.height()))
        return 1;               // off screen

    bmpFile = SD.open(nm);      
    bmpID = read16(bmpFile);  
    (void) read32(bmpFile);   
    (void) read32(bmpFile);  
    bmpImageoffset = read32(bmpFile);    
    (void) read32(bmpFile);    
    bmpWidth = read32(bmpFile);
    bmpHeight = read32(bmpFile);
    n = read16(bmpFile);      
    bmpDepth = read16(bmpFile); 
    pos = read32(bmpFile);   
    if (bmpID != 0x4D42) ret = 2;
    else if (n != 1) ret = 3; 
    else if (pos != 0 && pos != 3) ret = 4;
    else if (bmpDepth < 16 && bmpDepth > PALETTEDEPTH) ret = 5;
    else {
        bool first = true;
        is565 = (pos == 3);             
        
        rowSize = (bmpWidth * bmpDepth / 8 + 3) & ~3;
        if (bmpHeight < 0) {              
            bmpHeight = -bmpHeight;
            flip = false;
        }

        w = bmpWidth;
        h = bmpHeight;
        if ((x + w) >= tft.width())      
            w = tft.width() - x;
        if ((y + h) >= tft.height())      
            h = tft.height() - y;

        if (bmpDepth <= PALETTEDEPTH) {   
            bmpFile.seek(BMPIMAGEOFFSET);
            bitmask = 0xFF;
            if (bmpDepth < 8)
                bitmask >>= bmpDepth;
            bitshift = 8 - bmpDepth;
            n = 1 << bmpDepth;
            lcdbufsiz -= n;
            palette = lcdbuffer + lcdbufsiz;
            for (col = 0; col < n; col++) {
                pos = read32(bmpFile);  
                palette[col] = ((pos & 0x0000F8) >> 3) | ((pos & 0x00FC00) >> 5) | ((pos & 0xF80000) >> 8);
            }
        }

      
        tft.setAddrWindow(x, y, x + w - 1, y + h - 1);
        for (row = 0; row < h; row++) { // For each scanline...
           
            uint8_t r, g, b, *sdptr;
            int lcdidx, lcdleft;
            if (flip)   // Bitmap is stored bottom-to-top order (normal BMP)
                pos = bmpImageoffset + (bmpHeight - 1 - row) * rowSize;
            else        // Bitmap is stored top-to-bottom
                pos = bmpImageoffset + row * rowSize;
            if (bmpFile.position() != pos) { 
                bmpFile.seek(pos);
                buffidx = sizeof(sdbuffer);
            }

            for (col = 0; col < w; ) {  //pixels in row
                lcdleft = w - col;
                if (lcdleft > lcdbufsiz) lcdleft = lcdbufsiz;
                for (lcdidx = 0; lcdidx < lcdleft; lcdidx++) { 
                    uint16_t color;
                    if (buffidx >= sizeof(sdbuffer)) {
                        bmpFile.read(sdbuffer, sizeof(sdbuffer));
                        buffidx = 0;
                        r = 0;
                    }
                    switch (bmpDepth) {        
                        case 24:
                            b = sdbuffer[buffidx++];
                            g = sdbuffer[buffidx++];
                            r = sdbuffer[buffidx++];
                            color = tft.color565(r, g, b);
                            break;
                        case 16:
                            b = sdbuffer[buffidx++];
                            r = sdbuffer[buffidx++];
                            if (is565)
                                color = (r << 8) | (b);
                            else
                                color = (r << 9) | ((b & 0xE0) << 1) | (b & 0x1F);
                            break;
                        case 1:
                        case 4:
                        case 8:
                            if (r == 0)
                                b = sdbuffer[buffidx++], r = 8;
                            color = palette[(b >> bitshift) & bitmask];
                            r -= bmpDepth;
                            b <<= bmpDepth;
                            break;
                    }
                    lcdbuffer[lcdidx] = color;

                }
                tft.pushColors(lcdbuffer, lcdidx, first);
                first = false;
                col += lcdidx;
            }           // end cols
        }               // end rows
        tft.setAddrWindow(0, 0, tft.width() - 1, tft.height() - 1); 
        ret = 0;        // good render
    }
    bmpFile.close();
    return (ret);
}

struct
{
    uint32_t total;
    uint32_t ok;
    uint32_t crc_error;
    uint32_t time_out;
    uint32_t connect;
    uint32_t ack_l;
    uint32_t ack_h;
    uint32_t unknown;
} stat = { 0,0,0,0,0,0,0,0};

void setup()
{   Serial.begin(115200);
    tft.reset();
    uint16_t ID;
    ID = tft.readID();
    Serial.print(F("ID = 0x"));
    Serial.println(ID, HEX);
    tft.begin(ID);
    tft.fillScreen(0x001F);
    tft.setRotation(1);
    tft.setTextColor(0x0000, 0xffff);
    tft.setTextSize(2);
    bool good = SD.begin(SD_CS);
    if (!good) {
        Serial.println(F("cannot start SD"));
        while (1);
    }
    uint8_t ret = showBMP("/krista~1.bmp", 0, 0);
    Serial.print(F("/krista~1.bmp returns:"));
    Serial.println(ret);
}

void loop() {
  
  DHT.read22(DHT22_PIN);
 
  tft.setCursor(0, 10);
  tft.print("TEMPERATURA: ");
  tft.print(DHT.temperature, 1);
  tft.println(" C");
  tft.setCursor(0, 35);
  tft.print("VLAGA: ");
  tft.print(DHT.humidity, 1);
  tft.print(" %");
 
  
  delay(2000);
    
}

What does the dht22 test code look like? And does it work with the display wired up?

Yes the dht22 test code runs normally even with the lcd plugged in mega. The test code is from library:

//
//    FILE: dht22_test.ino
//  AUTHOR: Rob Tillaart
// VERSION: 0.1.03
// PURPOSE: DHT library test sketch for DHT22 && Arduino
//     URL:
// HISTORY:
// 0.1.03 extended stats for all errors
// 0.1.02 added counters for error-regression testing.
// 0.1.01
// 0.1.00 initial version
//
// Released to the public domain
//

#include <dht.h>

dht DHT;

#define DHT22_PIN 52

struct
{
    uint32_t total;
    uint32_t ok;
    uint32_t crc_error;
    uint32_t time_out;
    uint32_t connect;
    uint32_t ack_l;
    uint32_t ack_h;
    uint32_t unknown;
} stat = { 0,0,0,0,0,0,0,0};

void setup()
{
    Serial.begin(115200);
    Serial.println("dht22_test.ino");
    Serial.print("LIBRARY VERSION: ");
    Serial.println(DHT_LIB_VERSION);
    Serial.println();
    Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)\tTime (us)");
}

void loop()
{
    // READ DATA
    Serial.print("DHT22, \t");

    uint32_t start = micros();
    int chk = DHT.read22(DHT22_PIN);
    uint32_t stop = micros();

    stat.total++;
    switch (chk)
    {
    case DHTLIB_OK:
        stat.ok++;
        Serial.print("OK,\t");
        break;
    case DHTLIB_ERROR_CHECKSUM:
        stat.crc_error++;
        Serial.print("Checksum error,\t");
        break;
    case DHTLIB_ERROR_TIMEOUT:
        stat.time_out++;
        Serial.print("Time out error,\t");
        break;
    default:
        stat.unknown++;
        Serial.print("Unknown error,\t");
        break;
    }
    // DISPLAY DATA
    Serial.print(DHT.humidity, 1);
    Serial.print(",\t");
    Serial.print(DHT.temperature, 1);
    Serial.print(",\t");
    Serial.print(stop - start);
    Serial.println();

    if (stat.total % 20 == 0)
    {
        Serial.println("\nTOT\tOK\tCRC\tTO\tUNK");
        Serial.print(stat.total);
        Serial.print("\t");
        Serial.print(stat.ok);
        Serial.print("\t");
        Serial.print(stat.crc_error);
        Serial.print("\t");
        Serial.print(stat.time_out);
        Serial.print("\t");
        Serial.print(stat.connect);
        Serial.print("\t");
        Serial.print(stat.ack_l);
        Serial.print("\t");
        Serial.print(stat.ack_h);
        Serial.print("\t");
        Serial.print(stat.unknown);
        Serial.println("\n");
    }
    delay(2000);
}
//
// END OF FILE
//

bump