I have been trying to interface an ADC with raspberry Pi namely AD7193 via SPI .

For that I have enabled my SPI and installed spidev on my pi.

but i dont know what to do next in order to get the output from my ADC on terminal. how should i proceed further?

I have luckily found a driver (in C) for the ADC i am trying to interface https://drive.google.com/open?id=1W30J_SZN0c4Ap4oEjAwbs9y3p9YlRG1w, but I don't know what to do with the it.

I also tried to understand this https://ez.analog.com/message/323497-ad7193-driver-with-raspberry-pi but i could not understand what is going on.

How can i start writing a code in c by using the drivers and where do i need to put these(drivers , if i even have to!?) files in the linux kernel system files(i am using raspbian on my pi3) in order to get it working from scratch?

  • There are hundreds of Raspberry Pi SPI tutorials. Perhaps looks at some for the MCP3008 to get the basic concepts. – joan Apr 27 '18 at 10:20
  • I have already checked that but that could not help me much as i am unable to understand how should i proceed with .dts files and drivers of my ADC ! – Prabhjot Singh Apr 27 '18 at 10:46
  • "i dont know what to do next" - neither do we, nor do we know what YOU have done. – Milliways Apr 27 '18 at 11:03
  • i have enabled the spi of my pi and installed the spidev driver in it.that's what i have done! but being a beginner i don't know how can i go further and get my adc working and give out samples to my input signals. – Prabhjot Singh Apr 27 '18 at 11:34
  • Is there any particular reason you must use C? You can use python to achieve the same result of read the data from AD7193 if it supports SPI. This tutorial will provide you the basic understanding on how to use spidev and communicate with SPI device. – hcheung Apr 27 '18 at 15:04

Have you read the datasheet on the AD7193? This will include enough information to tell you what data you need to send and receive.

I will admit that datasheets are a pain to read at first, but it is a necessary skill to learn. At first, they seem to give too much information, but with practice you find most of the information useful.

Raspberrypi.ord had an SPI tutorial.

SPI is just another serial interface. You send data to the DAC, you receive data from the DAC. It looks complex when you read the datasheet, but it really isn't.

  • i have an idea about the data sheet of AD7193 but my problem is how can i initiate things ? i dont know what steps do i need to follow to interface ad7193 with pi , i have already interfaced it with arduino but thats quite simple because of IDE , in pi i have the whole os so i dont know how i can do it there – Prabhjot Singh Apr 27 '18 at 15:26
  • You will have to read the SPI tutorial on raspberrypi.org. I linked it from my answer. I've you've done it with the Arguino, it isn't any more difficult to do this from the Pi. – NomadMaker Apr 27 '18 at 23:20
  • You might have to run raspi-config in order to run the SPI drivers on. I'd also suggest trying this from Python first. – NomadMaker Apr 27 '18 at 23:21
  • @PrabhjotSingh, if you done interface it with Arduino, then it is not difficult to interface it with RPi. I have two articles for interfacing with an LCD module which use SPI interface for both Arduino and RPi which will give you the idea on how to use SPI in both environments. – hcheung Apr 28 '18 at 1:23

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.