hi
i don't konw whether my ads1248 wreg command is correct. how can I make sure the spi communication is right?
my code is below. the /drdy is always 1. the adc1248 result is all 0.
ADC_CS_LO; DelayNmSec(1); ADC_RST_HI; ADC_RST_LO; ADC_RST_HI; DelayNmSec(1);
cmdbuf[0]=WREG|MUX0; cmdbuf[1]=0x0E; // cmdbuf[2]=0x01; //mux0 cmdbuf[3]=0x00; //0B00001010; //vbias ain1,ain3 cmdbuf[4]=0x20; //mux1 cmdbuf[5]=0x00; //0B01011111; //sys0 pga =32 , 2000sps cmdbuf[6]=0x00; //ofc0 cmdbuf[7]=0x00; //ofc1 cmdbuf[8]=0x00; //ofc2 cmdbuf[9]=0x00; //fsc0 cmdbuf[10]=0x00; //fsc1 cmdbuf[11]=0x00; //fsc2 cmdbuf[12]=0x00; //0B00000000; //idac0 cmdbuf[13]=0x04; //0B00001000; //idac1 cmdbuf[14]=0xCC; //GPIOCFG cmdbuf[15]=0x01; //GPIODIR cmdbuf[16]=0x00; //GPIODAT putsSPI1(17,&cmdbuf[0]);
ADC_CS_HI;
DelayNmSec(1); ADC_CS_LO; ADC_START_LO; ADC_START_HI; DelayNmSec(1); ADC_START_LO; DelayNmSec(12);
while(ADC_DRDY_STAT); WriteSPI1(0x12); for(i=0;i<3;i++) { WriteSPI1(0xff); while(!DataRdySPI1()); DelayNmSec(1); RX_BUF[i] = ReadSPI1(); } ADC_CS_HI; for(i=0;i<3;i++) { WriteUART1(RX_BUF[i]); }
Hello Yanbin,
Just looking at your code, it is difficult to try and pinpoint a specific reason why your having trouble. Please take a look through this posting: http://e2e.ti.com/forums/t/5104.aspx
If you review your SPI communication (using an oscilloscope) and everything appears to be correct with respect to the SPI clock polarity and phase requirements, the setup and hold requirements of the ADS1248, etc. I suggest you try and post your schematic so that we can review your connections. If you can also provide screen shots of the SPI interface, that would be helpful as well.
Regards,
Tom