Hi,
I am trying to interface 32-bit, 10 channel ADC-ADS1262 with LPC1768. In one of my previous post, I described the difficulty I was facing in interfacing the ADC. Now, I was able to make the communicate with the ADC. The issue which I am facing right now is I cannot read the converted digital data from ADC. Can anyone support me on this issue? I am attaching the code below.
(NB:- CS pin tied LOW and START pin tied HIGH permanently.)
// PROGRAM
#include “mbed.h”
//SERIAL PRINT
Serial pc(p13, p14); //TX , RX
//ADC PINS INITIALISATION
SPI adc(p5,p6,p7); // mosi, miso, sck
DigitalOut reset(p28); // reset
DigitalIn drdy(p27);
unsigned int SPI_RX_buff[10];
unsigned int ads1262_rx_data[10];
signed long int uads1262Count=0;
int main()
{
wait(0.2);
pc.printf(“TRIAL ADC PROGRAM - 00001\n\n”);
wait_ms(10);
wait(0.001);
adc.format(8,3); //8,0
adc.frequency(1000000);
reset=0;
wait_us(1);
reset=1;
while(1)
{
status=drdy;
pc.printf("DRDY : %d\n",status);
reset=0;
wait_us(1);
reset=1;
unsigned char reg=0x14;
unsigned int dataToSend = 0x20|reg;
adc.write(dataToSend); //
adc.write(0x00); //number of registers
for(int i=0;i<=3;i++)
{
SPI_RX_buff[i] =adc.write(0x00);
pc.printf("DUMMY BUFFER[%d] : %x \n",i,SPI_RX_buff[i]);
}
ads1262_rx_data[0]= SPI_RX_buff[0]; // read 4 bytes adc count
ads1262_rx_data[1]= SPI_RX_buff[1];
ads1262_rx_data[2]= SPI_RX_buff[2];
ads1262_rx_data[3]= SPI_RX_buff[3];
pc.printf("RX_DATA : %d \n", ads1262_rx_data[0]);
pc.printf("RX_DATA : %d \n", ads1262_rx_data[1]);
pc.printf("RX_DATA : %d \n", ads1262_rx_data[2]);
pc.printf("RX_DATA : %d \n\n", ads1262_rx_data[3]);
uads1262Count = ((ads1262_rx_data[0]<<24)|(ads1262_rx_data[1]<<16)|(ads1262_rx_data[2]<<8)|ads1262_rx_data[3]);
pc.printf("REGISTER : %x \n",reg);
pc.printf("DATA : %d \n",uads1262Count);
}
}