Capacitive PiTFT + RFID MFRC522

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
seng177
 
Posts: 7
Joined: Wed May 25, 2016 2:28 am

Capacitive PiTFT + RFID MFRC522

Post by seng177 »

Hi, i plan to integrate MFRC522 RFID Reader and PiTFT 2.8" Capacitive touchscreen with my Pi 3, but I found out that capacitive touchscreen need to use the hardware SPI Pins (SCK, MOSI, MISO), then RC522 also uses SPI (MOSI, MISO & SCK) pins.
So is it possible to run both MFRC522 RFID Reader and PiTFT 2.8" Capacitive touchscreen together with my Pi 3?
Can SPi pins being shared by different SPI devices?
Thanks.

Here's the connection of the RFID RC522.
Image


After installing the "easy install" image for touchscreen, /dev/spidev* disappear...
https://www.forums.adafruit.com/viewtop ... 47&t=57645

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Capacitive PiTFT + RFID MFRC522

Post by adafruit_support_rick »

SPI devices can share SCK, MISO, and MOSI. They must use separate CS lines. The Pi has two CS lines, and the capacitive PiTFT uses one of them. The other CS is free for your RFID to use.

User avatar
seng177
 
Posts: 7
Joined: Wed May 25, 2016 2:28 am

Re: Capacitive PiTFT + RFID MFRC522

Post by seng177 »

thanks for your reply, that is also what i understand as capacitive touchscreen only use CE0 pin, CE1 pin is free.
But once use "easy install" image, the /dev/spidev0.0 and /dev/spidev0.1 disappear, even after enable SPI in "sudo raspi-config", they are not showing up, hence can't detect RC522 device.
The only way to make them appear is by comment out the "dtoverlay=pitft28c,rotate=90,speed=32000000,fps=20" line in /boot/config.txt

but after comment out that line, touchscreen just show blank/white screen after reboot.

any solution to release /dev/spidev from capacitive PiTFT?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Capacitive PiTFT + RFID MFRC522

Post by adafruit_support_rick »

Are you using the correct easy-install image? The resistive touch PiTFT uses both chip enables. Are you sure you're not using that image?

User avatar
seng177
 
Posts: 7
Joined: Wed May 25, 2016 2:28 am

Re: Capacitive PiTFT + RFID MFRC522

Post by seng177 »

Yes i am using PiTFT plus 320x240 capacitive touchscreen + Pi 3 board.
The easy install image i am using is the latest 25th Mar 2016 jessie capacitive image.
https://adafruit-download.s3.amazonaws. ... TFT28c.zip

User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: Capacitive PiTFT + RFID MFRC522

Post by adafruit2 »

yah we don't have any fix at this time - you could write bitbang SPI for the RFID board, that's our best suggestion

User avatar
seng177
 
Posts: 7
Joined: Wed May 25, 2016 2:28 am

Re: Capacitive PiTFT + RFID MFRC522

Post by seng177 »

ok thanks for your info, i will change to use PN532 NFC/RFID reader for my project, which able to communicate with reader through UART port, without using SPI.
https://learn.adafruit.com/adafruit-nfc ... i?view=all

User avatar
AlexHolsgrove
 
Posts: 7
Joined: Sun Jul 22, 2018 5:19 pm

Re: Capacitive PiTFT + RFID MFRC522

Post by AlexHolsgrove »

For anyone having the same problem, I have found a solution which is answered on the Raspberry Pi Stack Exchange question here: https://raspberrypi.stackexchange.com/q ... 7720#87720

Essentially, enable

Code: Select all

dtoverlay=spi1-3cs
in

Code: Select all

/boot/config.txt
My RFID board was connected:

Code: Select all

RFID    Pi Pin  Pin Name
SDA     36      SPI1 CE2
SCK     40      SPI1 SCLK
MOSI    38      SPI1 MOSI
MISO    35      SPI1 MISO
IRQ     29      GPIO5
GND     39      Ground
RST     31      GPIO6
3.3V    17      VDD_3V3
And then I modified the call to setup the RFID:

Code: Select all

def __init__(self, bus=0, device=0, speed=1000000, pin_rst=def_pin_rst,
            pin_ce=0, pin_irq=def_pin_irq, pin_mode = def_pin_mode):
Using this modified line in my code:

Code: Select all

rdr = RFID(1, 2, 1000000, 31, 0, 29)
Hope that helps!

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”