This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS1120-Q1: ADS1120-Q1 Communication: Read back data is always 0xFF

Part Number: ADS1120-Q1

Hello

I have been using ADS1120-Q1 for reading an analog voltage on the IN0 pin vs AVSS (IN1,IN2,IN3,REFN0,REFP0,DRDY are left unused & VA is fed 5V & CLK pin is tied to GND) & the configuration registers are set as below: 

Configuration Register 0 : 0x81

Configuration Register 1 : 0x04

Configuration Register 2 : 0xD8

Configuration Register 3 : 0x00

Also I am following the sequence as mentioned in datasheet in 9.1.6 Pseudo Code Example section.

On reading back the written data I am reading 

 Configuration Register 0 : 0xFF

Configuration Register 1 : 0xFE

Configuration Register 2 : 0x80

Configuration Register 3 : 0x7F during the first read and eventually they are left shifted and are replaced by 0xFF.

I have also attached the firmware for your reference.

uint8_t rst_register = 0x06;
uint8_t write_register_0 = 0x40;
uint8_t read_register_0 = 0x20;
uint8_t register_data[4] = {0x81,0x04,0xD8,0x00};

uint8_t register_read_data[4];
uint8_t r_data[4];

uint8_t read_adc = 0x10;
uint8_t start_adc = 0x08;
uint8_t raw_adc;
double analog_current;



	HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);
	HAL_SPI_Transmit(&hspi1, &rst_register,1,100);
	HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET);
	HAL_Delay(1);


		HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);
		HAL_SPI_Transmit(&hspi1, &write_register_0,1,100);
		for(int i=0;i<4;i++)
		{
			HAL_SPI_Transmit(&hspi1, &register_data[i],1,100);
		}
		HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET);
		HAL_Delay(1);

		HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);
		HAL_SPI_Transmit(&hspi1, &read_register_0,1,100);
		for(int i=0;i<4;i++)
		{
			HAL_SPI_Receive(&hspi1, &register_read_data[i],1,100);
		}
		HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET);
		HAL_Delay(1);

LOOP:
{
		Read_External_ADC_Digital_Value();
}

void Read_External_ADC_Digital_Value(void)
{
	HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET);
	HAL_SPI_Transmit(&hspi1, 0x10,1,50);
	for(int i=0;i<4;i++)
	{
		HAL_SPI_Receive(&hspi1, &r_data[i],1,50);
	}
	HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET);

}
void External_ADC_Current_Update(void)
{
	analog_current = (raw_adc * 5000)/ 0xFFFF;
	//	analog_current = analog_current /10;
}

Regards

Roshan Anand

  • Hi Roshan,

    /DRDY is a good output signal which indicates if the data is ready, I would suggest you to monitor /DRDY to retrieve the data.

    Can you please provide timing plots with logic analyzer for register writing and reading? Your schematic will be helpful as well.

    Best regards,

    Dale