Hello,
I am trying to interface my MSP430f5529 with ads1298 (I am using just the IC in the TQFP package and have no peripherals attached ).I am coding the MSP430f5529 using energia software.
Connections:
All DVDD of ads1298 are connected to 3V3 (taken from MSP) and DGND grounded.
I am using my laptop to power the MSP430f5529.
MSP430f5529 ads1298
USCI_B0 MISO ---------------- Dout
USCI_B0 MOSI -------------- Din
USCI_B0 SCLK -------------- SCLK
pin P6_0 --------------------------- CLKSEL
pin P6_1-------------------------- CSbar
pin P6_2-------------------------- PWDNbar
pin P6_3-------------------------- RESETbar
pin P7_0 ------------------------- START
Right now, I am just trying to read the ID of the ads 1298.
I'm using the following code:
#include <SPI.h> #define csbar P6_1 #define pwdnbar P6_2 #define resetbar P6_3 #define clksel P6_0 #define start P7_0 void setup() { pinMode(csbar,OUTPUT); pinMode(pwdnbar,OUTPUT); pinMode(resetbar,OUTPUT); pinMode(clksel,OUTPUT); pinMode(start,OUTPUT); SPI.setDataMode(SPI_MODE1); SPI.begin(); Serial.begin(9600); digitalWrite(resetbar,LOW); digitalWrite(clksel,HIGH); digitalWrite(start,LOW); digitalWrite(pwdnbar,LOW); delay(1000); digitalWrite(start,HIGH); digitalWrite(pwdnbar,HIGH); digitalWrite(resetbar,HIGH); delay(1000); digitalWrite(resetbar,LOW); delay(150); digitalWrite(resetbar,HIGH);; delay(5000); digitalWrite(csbar,LOW); SPI.transfer(0x11); digitalWrite(csbar,HIGH); delay(100); } void regWrite(uint8_t address, uint8_t data) { uint8_t x=(0x40) | (address); uint8_t y=0x00; digitalWrite(csbar,LOW); SPI.transfer(x); SPI.transfer(y); SPI.transfer(data); digitalWrite(csbar, HIGH); } uint8_t regRead(uint8_t address) { uint8_t dump = 0xAA; uint8_t x = (0x20) | (address); uint8_t y = 0x00; digitalWrite(csbar,LOW); SPI.transfer(x); SPI.transfer(y); uint8_t buff = SPI.transfer(dump); digitalWrite(csbar,HIGH); return buff; } void loop() { unsigned char test; test = regRead(0x00); Serial.println(test); delay(500); // regWrite(0x07,0x07); // // delay(500); // // test = regRead(0x07); // Serial.println(test); // // delay(500); }
It just returns 0 as the output.
I have also seen the MOSI and MISO pins at an oscilloscope.I have noticed the following:
1) MOSI pin gives three 8 bit bursts where the bit remains constant at the RISING edge and changes every FALLING edge. I did not notice any change in this waveform even when I changed the mode to 0 or 2 or 3.
2) The amplitude of the voltage decreases (MOSI) when I connect this to Din from 3.3V to <0.5V.
3) NO data on the MISO pin.
The boot sequence is a combination of a previous post and the boot sequence from the datasheet.
Please advise, If I am going wrong somewhere.For quite some days now, I have read many posts concerning this but nothing seems to work.
ANY help would be very greatly appreciated.
Thanks so much.
Regards,
Harsh