Go Down

Topic: ESP32 - TFT - MFRC522 > Red stripes (Read 95 times) previous topic - next topic

bluebirdsoftware

Hello,

I have connected a 4" SPI TFT display to an ESP32. This works fine, display looks good and the text / images appear on the screen.

As soon as i  run this code, i get strange red stripes in the display (see image).
Code: [Select]
if ( ! mfrc522.PICC_IsNewCardPresent()) {
        return;
    }
   
    if ( ! mfrc522.PICC_ReadCardSerial()) {
        return;
    }

    MFRC522::PICC_Type picc_type = mfrc522.PICC_GetType(mfrc522.uid.sak);
   
   
    //mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
    if(picc_type == mfrc522.PICC_TYPE_MIFARE_UL) {
        beep(success);
    }
    else {
        beep(fail);
    }


If i keep my code the same except the part above, all the stripes are gone.

Does anyone know what the problem can be?
The display driver is ST7796_DRIVER


bluebirdsoftware


david_prentice

#2
Jul 02, 2020, 11:04 am Last Edit: Jul 02, 2020, 11:11 am by david_prentice
You have been a member for 9 months.

Please post links to your hardware i.e. ESP32 board,  TFT display.

Please quote which library(s) you are using and any library examples that do not work.

If all library examples work 100%,  paste/attach your custom sketch that exhibits the problem.   (and how you have wired it)

David.

bluebirdsoftware

#3
Jul 02, 2020, 01:42 pm Last Edit: Jul 02, 2020, 01:44 pm by bluebirdsoftware
You are right,

The hardware i am using is:

ESP32 WROVER
MFRC522
W5500 Ethernet
4" SPI TFT (https://nl.aliexpress.com/item/4000790899595.html?spm=a2g0s.9042311.0.0.16f84c4dLLDAAB)


The libraries i am using:
MFRC522 (https://github.com/miguelbalboa/rfid)
TFT_espi (https://github.com/Bodmer/TFT_eSPI)


The wiring diagram:




All code works, the only thing that doesn't work correctly is that when i combine the MFRC522 code together with the TFT display, i get those red stripes. Even than the RFID scanner works and i can write images or text to the display, i only get the strange stripes

As soon as i include this code the stripes appear:
Code: [Select]

if ( ! mfrc522.PICC_IsNewCardPresent()) {
        return;
    }
   
    if ( ! mfrc522.PICC_ReadCardSerial()) {
        return;
    }

    MFRC522::PICC_Type picc_type = mfrc522.PICC_GetType(mfrc522.uid.sak);
   
   
    //mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
    if(picc_type == mfrc522.PICC_TYPE_MIFARE_UL) {
        beep(success);
    }
    else {
        beep(fail);
    }

david_prentice

Please post a schematic that is readable.

It is not possible to identify what IOxx pin is connected to anything.

You have chosen to NOT paste the sketch.   So we can't even inspect your class constructors.

If you want readers to help,  you need to take 10 minutes from your life to provide proper information.

David.

bluebirdsoftware

I am not sure if this is more readable but maybe it is:


I posted the code, without that bit of code everything works fine (display shows everything correct).
The problem is in the code above.

I can post the code that writes the display:

Code: [Select]

spr.loadFont(FONT_SANSATION_REGULAR_100);
        spr.setTextColor(TFT_WHITE, TFT_BLACK);
   
        tft.setTextDatum(MC_DATUM);
   
        int xpos = tft.width() / 2;  // Centre of screen
        int ypos = tft.height() / 2;  // Centre of screen
   
        ClearDisplay();
        int font_width = spr.textWidth(current_time, 1) + 5;
        int font_height = spr.fontHeight(1);
        tft.setCursor(xpos - (font_width / 2), ypos - (font_height / 2));
        spr.printToSprite(current_time);



I know this bit works because it is exactly the same from the library example and like i said, when i remove the RFID code this shows correctly as well (without red stripe)

If you need anything else please let me know

Go Up