MFRC522-python icon indicating copy to clipboard operation
MFRC522-python copied to clipboard

Code not working with Raspberry pi model B+

Open mohamedbelhassen opened this issue 7 years ago • 33 comments

I would like to note that this code did not worked with the model B+ when executing (sudo python Read.py) I just got the following message:

Welcome to the MFRC522 data read example Press Ctrl-C to stop.

when I touch the tag nothing happens. Is there any diagnostic steps that I can follow to discover where is the bug?

mohamedbelhassen avatar Apr 23 '17 07:04 mohamedbelhassen

First check wires:

Name Pin # Pin name
SDA 24 GPIO8
SCK 23 GPIO11
MOSI 19 GPIO10
MISO 21 GPIO9
IRQ None None
GND Any Any Ground
RST 22 GPIO25
3.3V 1 3V3

If this is correct go to any tutorial and follow steps to install python-dev, enable SPI and change other settings on raspberry. If you are still stuck try to take fresh image and go by this tutorial; http://www.instructables.com/id/Raspberry-Pi-3-Model-B-MIFARE-RC522-RFID-Tag-Readi/

jozobozo301 avatar May 23 '17 21:05 jozobozo301

Similar problem. All wires are correct.

$ lsmod | grep spi

spidev             7373  4
spi_bcm2835        7596  0

koddr avatar Apr 22 '18 17:04 koddr

Similar problem. Board D1 indicator light,No response when approaching the card.

pi@raspberrypi:~/Dev/MFRC522-python $ lsmod | grep spi
spidev                 16384  0
spi_bcm2835            16384  0
pi@raspberrypi:~/Dev/MFRC522-python $ sudo apt-get install python2.7-dev
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
python2.7-dev 已经是最新版 (2.7.13-2+deb9u2)。
python2.7-dev 已设置为手动安装。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 1 个软件包未被升级。

dingdayu avatar Jul 22 '18 06:07 dingdayu

I've got the same issues as the above - same reading as dingdayu. Followed the directions at http://www.instructables.com/id/Raspberry-Pi-3-Model-B-MIFARE-RC522-RFID-Tag-Readi/ No errors or anything - just doesn't read.

I've actually got two Raspberry pi's with the same problem. One a model B V1.2 (in black case in photos 1 and 2) and one a B+ 2017 (in clear case photos 3 and 4). They are wired identically and using the same colour scheme - I can't see any problem with the wiring and I've tried replacing the wires. image image image image

$ lsmod | grep spi spidev 16384 0 spi_bcm2835 16384 0

Its powering up alright. I'm getting the following:

$ ls /dev/spi* /dev/spidev0.0 /dev/spidev0.1

The config.txt is showing:

dtparam=spi=on

When I run lsmod I see:

$ lsmod Module Size Used by fuse 110592 3 rfcomm 49152 4 bnep 20480 2 hci_uart 36864 1 btbcm 16384 1 hci_uart serdev 20480 1 hci_uart bluetooth 368640 29 hci_uart,bnep,btbcm,rfcomm ecdh_generic 28672 1 bluetooth brcmfmac 307200 0 brcmutil 16384 1 brcmfmac cfg80211 573440 1 brcmfmac spidev 16384 0 rfkill 28672 6 bluetooth,cfg80211 snd_bcm2835 32768 1 snd_pcm 98304 1 snd_bcm2835 snd_timer 32768 1 snd_pcm snd 69632 5 snd_timer,snd_bcm2835,snd_pcm spi_bcm2835 16384 0 fixed 16384 0 uio_pdrv_genirq 16384 0 uio 20480 1 uio_pdrv_genirq evdev 24576 6 i2c_dev 16384 0 ip_tables 24576 0 x_tables 32768 1 ip_tables ipv6 434176 22

I'm at my wits end trying to get this to work now for an office access card system. Can I please have help?

TJMurph avatar Sep 20 '18 09:09 TJMurph

Sorry should also add to the above that I've also tried two different RC522's. Currently got one hooked up to each pi but both having the same problem described at top of thread. All seems installed fine but not actually reading.

TJMurph avatar Sep 20 '18 09:09 TJMurph

Im not an expert, but the tutorial I followed suggested, that you have to enable bcm2708 instead of bcm 2835. I did that by adding the following line to the end of /boot/config.txt dtoverlay=spi-bcm2708 Maybe you can try this, I hope this helps!

ThomasWoeg avatar Sep 24 '18 06:09 ThomasWoeg

Thought that just related to the silicone of the chip itself which is different in the pi 3B. Since I'm out of ideas I gave it a go anyway though and still not working. Thanks for helping though.

TJMurph avatar Sep 24 '18 08:09 TJMurph

Well I bought a Raspberry Pi 3B+ two weeks ago and got it working following this git https://github.com/mxgxw/MFRC522-python So I'm not sure if your problem has something to do with it being a newer Pi

Edit: Nevermind, you're actually using the same library and did the same to implement it.

ThomasWoeg avatar Sep 24 '18 08:09 ThomasWoeg

I'm assuming you tried to run the Read.py file. What did that show?

ThomasWoeg avatar Sep 24 '18 08:09 ThomasWoeg

Same as the initial post unfortunately:

Welcome to the MFRC522 data read example Press Ctrl-C to stop.

when I touch the tag nothing happens.

TJMurph avatar Sep 24 '18 08:09 TJMurph

I did have the same problem with the 3B (two pi's tried and 2 different RFID readers)

TJMurph avatar Sep 24 '18 08:09 TJMurph

Would you possibly be able to post the read outs similar to the above you are getting with a working version please? Maybe I can work it out from there.

TJMurph avatar Sep 24 '18 09:09 TJMurph

Have you tried debugging or putting prints in the MFRC library, to see exactly which step, seems to be not working?

ThomasWoeg avatar Sep 24 '18 09:09 ThomasWoeg

Didn't hit any problems along the way when installing. Just didn't work at the end.

TJMurph avatar Sep 24 '18 09:09 TJMurph

Would you possibly be able to post the read outs similar to the above you are getting with a working version please? Maybe I can work it out from there.

Im not sure that I understand what you want from me, but this is the output I get (when it's working)

pi@raspberrypi:~/MFRC522-python $ sudo python Read.py Welcome to the MFRC522 data read example Press Ctrl-C to stop. Card detected Card read UID: 69,245,238,117 Size: 8 Sector 8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

ThomasWoeg avatar Sep 24 '18 09:09 ThomasWoeg

Could you tell me how things look when you run lsmod?

TJMurph avatar Sep 24 '18 09:09 TJMurph

and confirm that you are using the Stretch Version: 2.8.2 Release date: 2018-06-27

TJMurph avatar Sep 24 '18 09:09 TJMurph

my lsmod output

pi@raspberrypi:~ $ lsmod Module Size Used by rfcomm 49152 6 bnep 20480 2 hci_uart 36864 1 btbcm 16384 1 hci_uart serdev 20480 1 hci_uart bluetooth 368640 29 hci_uart,bnep,btbcm,rfcomm ecdh_generic 28672 1 bluetooth fuse 106496 3 binfmt_misc 20480 1 evdev 24576 6 joydev 20480 0 spidev 16384 0 brcmfmac 307200 0 brcmutil 16384 1 brcmfmac cfg80211 573440 1 brcmfmac rfkill 28672 6 bluetooth,cfg80211 snd_bcm2835 32768 1 snd_pcm 98304 1 snd_bcm2835 snd_timer 32768 1 snd_pcm snd 69632 5 snd_timer,snd_bcm2835,snd_pcm spi_bcm2835 16384 0 uio_pdrv_genirq 16384 0 fixed 16384 0 uio 20480 1 uio_pdrv_genirq i2c_dev 16384 0 ip_tables 24576 0 x_tables 32768 1 ip_tables ipv6 434176 22 how do i lookup the version?

ThomasWoeg avatar Sep 24 '18 09:09 ThomasWoeg

If you bought it two weeks ago and downloaded the latest image rather than an old one it’ll be that

TJMurph avatar Sep 24 '18 09:09 TJMurph

Thank you - you’ve been very helpful

TJMurph avatar Sep 24 '18 09:09 TJMurph

yeah i downloaded the latest image, and even did an apt-get update IIRC

ThomasWoeg avatar Sep 24 '18 09:09 ThomasWoeg

Only lines I can see that differ are: fuse 110592 3 fuse 106496 3 rfcomm 49152 4 rfcomm 49152 6 ...then you have the following that I don't at all: binfmt_misc 20480 1 joydev 20480 0

Unfortunately I lack the skills to know any more about why yours works and mine doesn't.

TJMurph avatar Sep 24 '18 12:09 TJMurph

What type of RFID tags do you have?

I noticed that MIFARE DESfire EV1 dont work, but EV2 do work

Edit: You can check which ones you exactly have with an android app (NXP Tag Info for example) if your smart phone has NFC

ThomasWoeg avatar Sep 24 '18 12:09 ThomasWoeg

Same ones that came with the RFID-RC522 devices

TJMurph avatar Sep 24 '18 14:09 TJMurph

That means that they should work.... Then I'm out of ideas. Sorry!

ThomasWoeg avatar Sep 24 '18 14:09 ThomasWoeg

I appreaciate the help anyway. Seems unlikely to be hardware problems on two different pi's with two different RC522's.

TJMurph avatar Sep 24 '18 14:09 TJMurph

I am also facing the same problem with raspberry pi B+...When RFID tag says it works at 13.56Mhz, do we need to configure this frequency in the code, bcoz the spi speed is set to 1Mhz? i tried but it didn't work, any other ideas to make it work

Mohanavadivel-git avatar Nov 29 '18 09:11 Mohanavadivel-git

Hello, has anyone been able to solve this? I am having the exact same issue. I installed successfully but i cant make it read :/

Erjona1 avatar May 23 '19 09:05 Erjona1

Hello, In my case, the problem was the RFID board itself. I just used another one from another seller and it worked fine

Le jeu. 23 mai 2019 à 10:45, Erjona1 [email protected] a écrit :

Hello, has anyone been able to solve this? I am having the exact same issue. I installed successfully but i cant make it read :/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mxgxw/MFRC522-python/issues/40?email_source=notifications&email_token=ACE7BMBJ2IZQEHFUJU7HK4TPWZRS3A5CNFSM4DIVKMQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWBVTLY#issuecomment-495147439, or mute the thread https://github.com/notifications/unsubscribe-auth/ACE7BMD4LEEUEFU4GUX5NC3PWZRS3ANCNFSM4DIVKMQQ .

mohamedbelhassen avatar May 23 '19 10:05 mohamedbelhassen

I was facing the same problem with MFRC522 and i just solve it connecting the RC522 IRQ pin into PIN 18 of GPIO

obdbeats avatar Aug 08 '19 05:08 obdbeats