Search code examples
intel-xdkspiadcintel-edison

Lost, trying to connect Intel Edison SPI to ADC using the intel XDC and node


I am using the intel XDK for the first time and I am trying to get a reading from this SPI ADC ADS7951SRGER 12 Bit Analog to Digital Converter 8 Input 1 SAR 24-VQFN (4x4) http://www.ti.com/lit/ds/symlink/ads7950.pdf

its connected like so

SPI_2_RXD -> MISO
SPI_2_TXD -> MOSI
SPI_2_CLK -> SCLK
SPI_2_FS0 -> ADC_CS

I have never used SPI before, I am very lost. I've been searching for 24 hours now and I'm not much closer to understanding what I'm supposed to do here.

here is the current hail mary code I'm trying. all I get back is ffffffff

var x = new m.Spi(0);
x.bitPerWord=12;
x.frequency = 20;


var buf = new Buffer(4);
buf[0] = char('0x0b');
buf[1] = char('0x11');
buf[2] = char('0x11');
buf[3] = char('0x11');
var buf2 = x.write(buf);


console.log("Sent: " + buf.toString('hex') + ". Received: " + buf2.toString('hex'));

Any help is appreciated


Solution

  • In the end, I had to pull the CS (SPI_2_FS0 -> ADC_CS) manually, pulling low before each write/read then high again.