Saturday, March 30, 2013

SPI Shenanigans



Arduino SPI Fun featuring ADS1298!

SPI Library

- SPI.setDataMode(SPI_MODE1);
  SPI.setBitOrder(MSBFIRST);
  SPI.setClockDivider(SPI_CLOCK_DIV4);

Different ways of communication we tried:
1) SPI.transfer(byte) only
We are not sure if this toggles SS before and after each byte sent. If this is so, then we cannot use this to send multi-byte commands.

2) digitalWrite(SS, LOW);
    shiftIn(dataPin, clockPin, bitOrder) or shiftOut(dataPin, clockPin, bitOrder, value)
    digitalWrite(SS, HIGH);

- According to the ADS1298 manual, we need a delay of >= 4 SCLK cycles before sending the next command. For our 4MHz clock this is 0.25uS * 4 = 1 uS.

Neither is working so far...

We can use analogWrite(pin, value) to generate an analog signal we can use to test the ADS1298 A-D coverter. *Only works on certain pins!

Some (maybe) helpful discussions on the TI forums:
http://e2e.ti.com/support/data_converters/precision_data_converters/f/73/t/188917.aspx
http://e2e.ti.com/support/data_converters/precision_data_converters/f/73/t/168648.aspx

SPI Connections we made to our toy A-D converter:




No comments:

Post a Comment