firsttris / mfrc522-rpi

:key: Control your MFRC522 RFID Module with your Raspberry-pi and JavaScript
MIT License
117 stars 34 forks source link

Use SPI1 #3

Closed liko28s closed 5 years ago

liko28s commented 6 years ago

Hi guys, we are currently doing a prototype that includes a MFRC522 (Robotdyn) reader and a 3.5 TFT screen from Waveshare, after a few days of fighting while we took the two devices (TFT screen in SPI0 and MFRC522 in SPI1), everything works correctly with but not with this library, we always receive the message Can not open the SPI device: There is no such file or directory but ls /dev/spidev* returns /dev/spidev1.0 any ideas for make wiringpi work in spi1?

firsttris commented 6 years ago

hey sir,

i think your issue is that i initialize wiringPI with channel 0 but you need channel 1 https://github.com/firsttris/mfrc522-rpi/blob/master/index.js#L7

wiringPiSPISetup (int channel, int speed) ;. This is the way to initialise a channel (The Pi has 2 channels; 0 and 1).

regards Tristan

firsttris commented 6 years ago

i will add the possibility to choose the spi channel

firsttris commented 6 years ago

please update to 1.1.0 where you have the ability to choose the spi channel. see example: https://github.com/firsttris/mfrc522-rpi/blob/master/test/read.js#L4

was not able to test it since im on leave currently.

best regards tristan

liko28s commented 6 years ago

In fact, it was the first change I made in the index, however I did not detect the device, I added a capture image note that MFRC522-PYTHON Works fine

firsttris commented 6 years ago

just to be sure... have you activated SPI in Raspbian properly ? https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md

liko28s commented 6 years ago

yes, in /boot/config.txt

dtparam=spi=on
dtoverlay=spi1-1cs
dtoverlay=pi3-disable-bt

bt is disable for security

firsttris commented 6 years ago

shouldn't dmesg detect the module appart from which implementation you are using?

i will do some tests when im back home.

how do i psyically connect my module to use SPI 1 ?

regards Tristan

firsttris commented 5 years ago

using soft-pi now instead of wiring-pi, please check and re-open if error still persists