xqzhou
Posts: 1
Joined: Sat May 07, 2016 8:39 am

Raspberry PI 3 and RFID-RC522 Problem reading data

Sat May 07, 2016 9:00 am

Hello everyone,

I'm using a raspberry pi 3 model B and a RFID-RC522 module and configured my rpi using following steps:

1) Enabled spi using raspi-config
2) Installed SPI-py
3) Set pins like this:

Code: Select all

sda   24
sck   23
mosi  19
miso  21
gnd   20
rst   22
3.3v  1
4) Tried several rfid reading/writing libraries and none of those can read card uid
https://github.com/rasplay/MFRC522-python.git
https://github.com/ondryaso/pi-rc522.git
rpi-rc522


Some diagnostic output:

Code: Select all

$ lsmod
Module                  Size  Used by
bnep                   10336  2
hci_uart               13533  1
btbcm                   4196  1 hci_uart
bluetooth             317981  22 bnep,btbcm,hci_uart
brcmfmac              177635  0
brcmutil                5501  1 brcmfmac
cfg80211              407580  1 brcmfmac
joydev                  9024  0
evdev                  10278  2
rfkill                 16036  4 cfg80211,bluetooth
snd_bcm2835            19802  0
snd_pcm                73474  1 snd_bcm2835
snd_timer              18848  1 snd_pcm
bcm2835_rng             1763  0
bcm2835_gpiomem         2860  0
snd                    50779  3 snd_bcm2835,snd_timer,snd_pcm
spi_bcm2835             7074  0
uio_pdrv_genirq         2944  0
uio                     7753  1 uio_pdrv_genirq
ipv6                  338660  30

Code: Select all

$ls /dev/spidev0.*
/dev/spidev0.0  /dev/spidev0.1
Someone experiencing the same issue?
Any help is appreciated.


luigibyte
Posts: 3
Joined: Thu May 19, 2016 2:06 am

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Thu May 19, 2016 2:09 am

Same issue here.

Raspberry Pi 3 + rfid rc522

Unable to read tag. Nothing happens

cscuilla
Posts: 54
Joined: Tue Apr 26, 2016 6:35 pm

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Thu May 19, 2016 6:12 pm

Same issue for me. I believe it has something to do with latest version of Jessie. As if I install the latest version of Jessie on my pi2, I get the same issue. If I install Wheezy, it works with no problem.

cscuilla
Posts: 54
Joined: Tue Apr 26, 2016 6:35 pm

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Thu May 19, 2016 7:13 pm

I have confirmed the issue is with Jessie..

To get MFRC522 working on Pi3, here is what I did..

Install Wheezy on a Pi2 and fully update it.

Now transfer memory card to Pi3.

Card reader will now work.

cscuilla
Posts: 54
Joined: Tue Apr 26, 2016 6:35 pm

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Fri May 20, 2016 4:10 pm

the card reader will also work on pi3 using Jessie version

2016-03-18-raspbian-jessie

It's the latest release which breaks the compatibility. My best guess is it's something to do with spi.

If you install spi on latest jessie release, then type lsmod, you get the following..
spi_bcm2835

If you install spi on 2016-03-18-raspbian-jessie you get the following..
spi_bcm2708.

Fixing this is above my paygrade, however I feel if you can convert the spi back to 2708 it will work. Please let me know if anyone knows how to do this. I'm going to try posting in the device tree forum

luigibyte
Posts: 3
Joined: Thu May 19, 2016 2:06 am

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Sat May 21, 2016 4:29 pm

Confirmed!

Using jessie image of 2016-03-18 it worked.

I followed this tutorial: http://raspmer.blogspot.com.ar/2015/07/ ... pbian.html

waterscar
Posts: 1
Joined: Thu Jul 28, 2016 3:32 am

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Thu Jul 28, 2016 3:45 am

I've successfully made it to work with latest image 2016-05-27. Here's the steps I did:
1. update

Code: Select all

sudo apt-get update
sudo apt-get upgrade
2. kernel update to enable spi

Code: Select all

sudo rpi-update
3. Enable SPI in

Code: Select all

sudo raspi-config
4. reboot

5. Add overlay to /boot/config.txt

Code: Select all

dtoverlay=spi0-hw-cs
6.reboot

7. verify the pin 24 is correctly set via command

Code: Select all

gpio readall
Correct outcome should be: "24 | 1 | ALT0 | CE0 | 10 | 8 |"
If it's IN or OUT, then it doesn't work, could be something wrong with above steps

8. follow the "standard" steps to install SPI-PY and MFRC522-python

Code: Select all

sudo apt-get install -y python-dev
git clone https://github.com/lthiery/SPI-Py.git

cd SPI-Py
sudo python setup.py install
cd ..

git clone https://github.com/mxgxw/MFRC522-python.git

cd MFRC522-python


* You should be ready to read your first RFID Tag! Type:

python Read.py
The issue itself and the fix of it is described here: https://github.com/raspberrypi/linux/issues/1547

gastone_2005
Posts: 2
Joined: Wed Aug 03, 2016 2:20 pm

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Wed Aug 03, 2016 2:26 pm

waterscar wrote:I've successfully made it to work with latest image 2016-05-27. Here's the steps I did:
1. update

Code: Select all

sudo apt-get update
sudo apt-get upgrade
2. kernel update to enable spi

Code: Select all

sudo rpi-update
3. Enable SPI in

Code: Select all

sudo raspi-config
4. reboot

5. Add overlay to /boot/config.txt

Code: Select all

dtoverlay=spi0-hw-cs
6.reboot

7. verify the pin 24 is correctly set via command

Code: Select all

gpio readall
Correct outcome should be: "24 | 1 | ALT0 | CE0 | 10 | 8 |"
If it's IN or OUT, then it doesn't work, could be something wrong with above steps

8. follow the "standard" steps to install SPI-PY and MFRC522-python

Code: Select all

sudo apt-get install -y python-dev
git clone https://github.com/lthiery/SPI-Py.git

cd SPI-Py
sudo python setup.py install
cd ..

git clone https://github.com/mxgxw/MFRC522-python.git

cd MFRC522-python


* You should be ready to read your first RFID Tag! Type:

python Read.py
The issue itself and the fix of it is described here: https://github.com/raspberrypi/linux/issues/1547
This solution works. But since pieces of your answer are copied from another thread or article, I think you should mention the source. Other peoples' work should be credited.

http://www.instructables.com/id/Raspber ... -software/

shadowfxd
Posts: 4
Joined: Mon Aug 22, 2016 4:47 am

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Fri Sep 02, 2016 11:08 pm

I also cannot get the RFID RC522 working on pi. When I start "Read.py" it just sits there and doesn't recognize the RFID cards at all. Any suggestions? I've tried everything in this topic.

cscuilla
Posts: 54
Joined: Tue Apr 26, 2016 6:35 pm

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Fri Sep 02, 2016 11:12 pm

I've had a couple that the key fob and cards that it came with we're the wrong kind. Make sure your using mifare 1k cards/fobs.

gastone_2005
Posts: 2
Joined: Wed Aug 03, 2016 2:20 pm

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Sat Sep 03, 2016 1:25 pm

shadowfxd wrote:I also cannot get the RFID RC522 working on pi. When I start "Read.py" it just sits there and doesn't recognize the RFID cards at all. Any suggestions? I've tried everything in this topic.
Please open a new thread so other people don't get overwhelmed and confused. Start by telling us about you raspberry pi, the RFID module you are using and the OS.

ForBrains.22
Posts: 1
Joined: Sun Nov 20, 2016 11:58 pm

Re: Raspberry PI 3 and RFID-RC522 Problem reading data

Mon Nov 21, 2016 12:14 am

If on a RPi 3 be aware of the GPIO numbers.
SPI_CLK on a RPi 3 is Pin number 23 = GPIO11 (not 22)

In my case I needed to edit 2 lines in:
MFRC522-python/MFRC522.py

Line 10
Change: NRSTPD = 22 to NRSTPD = 11

Line 113:
Change GPIO.setup(22, GPIO.OUT) to GPIO.setup(11, GPIO.OUT)


The code assumes SPI_CLK is GPIO22 when on RPi3 it is GPIO11.

On my Pi3 I:
1) Installed Ubuntu Mate 16.04.1 LTS
2) rasp-config
3) In "Advanced" i "Enabled SPI", and set it to automatically load the module
4) Rebooted
5) lsmod | grep "spi" shows spi_bcm2835
6) I needed to "apt-get install git python"
7) Install MFRC522-py using git.
8) Make those 2 lines of changes
9) Run "python Read.py"
10) Scan a tag. I then got:

Card detected
Card read UID: 51,86,201,28
Size: 8
AUTH ERROR!!
AUTH ERROR(status2reg & 0x08) != 0
Authentication error

11) A different type of tag showed:

Card detected
Card read UID: 201,216,42,40
Size: 8
Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 8 guests