2

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:~ $
  • Are you using Raspbian? What does uname -a report? What does cat /etc/os-release report. Edit the answers into your question. – joan Oct 4 '17 at 17:51
  • 1
    All you need to do is have the line dtparam=spi=on in /boot/config.txt. I suspect the set-up for your LCD screen is claiming both SPI channels by mistake. You could test by removing whatever you are using to set-up the LCD screen and seeing if the SPI devices then appear. – joan Oct 4 '17 at 20:12
  • OK I go try it. – SmileDeveloper Oct 5 '17 at 7:50
  • Okay, But i want that the LCD screen and RFID reader is working. So i want to use SPI1. Not only LCD screen or RFID reader – SmileDeveloper Oct 5 '17 at 9:42
  • if i go try with bcm2835 to connect to my rfid reader the lcd screen turns off. – SmileDeveloper Oct 5 '17 at 9:44
2

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.

  • It seems that cs0_pin can be any unused GPIO pin. It expects BCM numbers only. source – Neal Ehardt Jan 22 at 2:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.