New member (Pete) here, and I have delayed seeking help from a forum for the first month of my efforts with Pi, figuring I might in some ways remember things better if I work through the learning curve myself. Talking of remembering I’m the wrong side of 70 now and short term memory is becoming an issue- lots of repetition usually sorts it. In the past I’ve done lots of home automation stuff using the Picaxe platform so not a complete newbie but C++ code seems a step up from Basic. Anyway, my specific issue here is that I cannot find/download/install/import a code snippet called spidev. I am trying to hook up up an MCP2003 ADC to as I need to analyse an analogue voltage, what with Pi lacking an analogue input. All web advice/tutorials so far states that spidev is needed, but I cannot persuade pi to install it. In fact using Synaptic to check the online ‘store’ it seems not be there so not surprising. Might there be an alternative code? If not can anyone point out a way of accessing an analogue input. I might add that I’ve not got far with I2C either for a 9 axis device, but let’s stick with SPI for now. It may be something stupid on my behalf but I’ve installed lots of other code so far. Final thought- is Spidev not built into Pi these days? I have latest build installed. Thanks, PF
You seem to be thinking of the
spidev Linux kernel driver. I don't currently use
spi myself (
i2c is an alternative in some cases), so what follows involves a bit of guesswork:
On the RPi, I think the driver is included, but you will need to enable support for it using either
raspi-config or the device tree via
/boot/config.txt. You should be able to find the details you need via an Internet search.
I'll stop here, but hopefully this will get you started. Feel free to ask more questions if you like. This is generally a helpful site, and most of the users are cordial; there are exceptions of course, but don't let that put you off. You should take the Tour, and read some of the guidance on asking good questions, etc. Learning how the site works is a small investment that will lead to better answers.
If your question is about using the SPI kernel driver things have changed since Device Tree. You should forget any ancient tutorial suggesting the need for a download.
You CAN enable by editing config.txt, but the normal way would be to enable SPI in
raspi-config. The same applies for other interfaces, but for many you would be better to use an appropriate dtoverlay.
There is a python module
spidev which can be installed using