5

I have installed a LCD screen that use my SPI0 bus and I2C but i want to connect my RFID reader to the same raspberry. My lcd screen can you see here: https://www.adafruit.com/product/1601

SPI1 will not be enabled with SPI0, i have searched for Enable SPI1 for raspberry Or Raspberry SPI1... But must results is links to enable SPI0 or SPI1 for python or SPI0 for c++

I want to use C++ as programming language. (you may send me C libarys but not Python)

This is the content of the raspberry file /boot/config.txt

https://pastebin.com/GrvAGzwx

Please tell me step step-by-step how you install SPI1 with SPI0 with C++

Can anybody help me please? Thank you. If you have the same problem please vote me. If you fix how i can enable the SPI and wich libary support SPI1 on C++ or C then you figured out my problem.

Added: Raspbian information:

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.52-v7+ #1038 SMP Fri Sep 29 16:26:52 BST 2017 armv7l GNU/Linux
pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@raspberrypi:~ $
SmileDeveloper
  • 161
  • 1
  • 1
  • 5

4 Answers4

6

In order to use the spi1 port of the Raspberry Pi, you need to set the dtoverlay=spi1-1cs in /boot/config.txt. By default this will use the pins (https://pinout.xyz/pinout/spi):

  • MOSI - pin 38
  • MISO - pin 35
  • CE0 - pin 12
  • CLK - pin 40

You can change the CE0 pin (e.g. to pin 23) by adding ,cs0_pin=23 to the overlay. See /boot/overlays/README for more info.

steviethecat
  • 271
  • 1
  • 13
1

In case anyone had the same problem, I had the same situation: using 3.5" LCD and MFRC522 at the same time. LCD driver is this and MFRC522 driver is this.

I added this line at the end of config.txt and it worked!

It seems LCD driver claims GPIO7 & GPIO8 pins.

dtoverlay=spi1-3cs,cs0_pin=05,cs1_pin=06,cs2_pin=16
BHP
  • 111
  • 4
0

Thank you all for the tips.

In my case, just add this dtoverlay=spi1-3cs to /boot/config.txt and reboot

I changed too in the MFRC522 library the following parameter: /dev/spidev0.0 to /dev/spidev1.0

In the pins were like this:

  • SDA/CE2: 36
  • MISO: 35
  • MOSI: 38
  • SCKL: 40
  • RESET: 13
0

I have a dts overlay for reComputer-R1000 which can be found here:

https://github.com/Seeed-Studio/seeed-linux-dtoverlays/blob/master/overlays/rpi/reComputer-R100x-overlay.dts

I have tried several methods, but am not able to turn on the SPI0. Can someone suggest me, given the override parameters in this dts, how can i turn on SPI0?