The model which i am using is Raspberry Pi 2 Model B. The use of spi came across when i need to convert analogue value into digital value through the use of the MCP3008 chip. I would like to mention the step that i had gone through for the generation of the clk signal.

1) I enabled spi through the use of rasp-config and it is enabled.

2) I check when both channel for spi is enabled or not just by using command cd /etc/dev* and it shows desired result.

3) I check through the use of lsmod and it shows spi_bcm2385.

4)And i compiledthe code and it gets compiled successfully. As mentioned in the tutorial of the wiring pi, i type gpio load spi and it shows the error and i use the alternative way of doing this by refering to website of https://projects.drogon.net/understanding-spi-on-the-raspberry-pi/.

And i performed sudo modprobe spi_bcm2385

sudo chown id -u.id -g /dev/spidev0.* and i recheck it using lsmod and it shows.

#include <wiringPiSPI.h>
#include <stdio.h>
#include <stdint.h>

int main(int argc, char *argv[])
   int a;
   int chan = 1;
   int speed = 1000000;
   printf("Data workout problem \n");

   a = wiringPiSPISetup (chan, speed);
   printf("%d \n", a);

5) i run the code throgh the use of sudo command and it runs successfully.

Even though i performed all the above steps carefully, when i check the d.c voltage and frequency of it by the use of FLUKE multimeter, it shows zero value in d.c voltage and zero frequency. Is it compulsory that it works when connected to external device or chip or might be i am wrong in any step above. Plz guide me. Thanks in advance.

  • As I said on raspberrypi.org you need a scope. Checking a clock with a multimeter will not work. – joan Jul 21 '16 at 19:08
  • @joan my digital multimeter has a frequency measuring setting. – Milliways Jul 22 '16 at 0:02
  • I am unclear what you are actually asking. You should describe WHAT YOU DID not refer to some obsolete links. What OS? Current versions do NOT use modprobe and you should enable SPI through raspi-config (or manually edit config.txt. – Milliways Jul 22 '16 at 0:06
  • @Milliways i am using raspbian jessie as the os in raspberry pi 2 model B. I had updated it and upgraded jst yesterday. i found out still it supports modprobe commands, u can check it out. Well, i refered to the datasheet of BCM2385 and what i found in the note section is: SCLK is only generated during byte serial transfer. It pauses in the rest state if the next byte to send is not ready or RXF is set. I had been checking the whole time clk signal without connecting ADC chip which might be the problem. I will be checking it soon in my project room and will give u update about it. – Abhaya Singh Pandey Jul 22 '16 at 5:11
  • I did not say modprobe does not exist, but it is not used. Some people still use SysV and disable Device Tree, but modprobe is not the recommended method of enabling SPI – Milliways Jul 22 '16 at 5:30

Your Answer

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

Browse other questions tagged or ask your own question.