Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Conflict with MFRC522 and ST7735 libraries

Threaded View

  1. #1

    Conflict with MFRC522 and ST7735 libraries

    I am trying to get an LCD screen to work with an rfid reader using the MFRC522 lib with the ST7735 lib on Teensy 3.2.

    Here are the LCD and RFID reader:

    I can get each to work independently but when I initialize the LCD the rfid reader fails with this warning:
    WARNING: Communication failure, is the MFRC522 properly connected?

    I suspect it is a communication problem involving SPI but I am not advanced enough to solved this. Have tried for many hours.

    I have assigned the pins so that there is no conflict and both libraries appear to utilize the SPI.beginTransaction() and SPI.endTransaction() functions. (I found a version of ST7735 with this but it did not solve the issue).

    Here is the code I am using. If I comment out the line 'tft.initR(INITR_BLACKAB);' then the reader works. Screen works if I un-comment but not both at the same time.

    #include <Adafruit_GFX.h>
    #include <Adafruit_ST7735.h> 
    #include <SPI.h>
    #include <MFRC522.h>
    #define sclk 14  // SCLK can also use pin 14
    #define mosi 7  // MOSI can also use pin 7
    #define cs   20  // CS & DC can use pins 2, 6, 9, 10, 15, 20, 21, 22, 23
    #define dc   21   //  but certain pairs must NOT be used: 2+10, 6+9, 20+23, 21+22
    #define rst  8   // RST can use any pin
    #define sdcs 4   // CS for SD card, can use any pin
    #define RST_PIN    9   // 
    #define SS_PIN    10    //
    Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);
    MFRC522 mfrc522(SS_PIN, RST_PIN);
    void setup(void) {
      pinMode(sdcs, INPUT_PULLUP);  // don't touch the SD card
      pinMode(SS_PIN, OUTPUT);
      while (!Serial);    // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
      mfrc522.PCD_Init();   // Init MFRC522
      mfrc522.PCD_DumpVersionToSerial();  // Show details of PCD - MFRC522 Card Reader details
      Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
    void loop() 
      // Look for new cards
      if ( ! mfrc522.PICC_IsNewCardPresent()) {
      // Select one of the cards
      if ( ! mfrc522.PICC_ReadCardSerial()) {
      // Dump debug info about the card; PICC_HaltA() is automatically called
    Any help would be most appreciated!
    Last edited by KBR; 03-27-2017 at 06:47 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts