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.

ADS8675: Problem in reading and writing in registers

Part Number: ADS8675
Other Parts Discussed in Thread: ADS8689

Hello, 

My name is Rameez, I'm trying to write and read into the registers of ADS8675 through STM32 using HAL lib. 

HAL_GPIO_WritePin(GPIOA, CS_Pin, GPIO_PIN_SET); /////// turn CS off
	HAL_Delay(10);
	
	HAL_GPIO_WritePin(GPIOA, CS_Pin, GPIO_PIN_RESET); /////// turn CS on
	spiData[0]=0xD0;
	spiData[1]=0x04;
	spiData[2]=0x00;
	spiData[3]=0x10;
	HAL_SPI_Transmit(&hspi1,spiData,4,50);
	HAL_GPIO_WritePin(GPIOA, CS_Pin, GPIO_PIN_SET); /////// turn CS off
	
	HAL_GPIO_WritePin(GPIOA, CS_Pin, GPIO_PIN_RESET); /////// turn CS on
	spiData2[0]=0x48;
	spiData2[1]=0x04;
	spiData[2]=0x00;
	spiData[3]=0x00;
	HAL_SPI_Transmit(&hspi1,spiData2,4,50);
	HAL_Delay(1000);
	HAL_SPI_Receive(&hspi1,rx_buff,4,50);
	HAL_GPIO_WritePin(GPIOA, CS_Pin, GPIO_PIN_SET); /////// turn CS off

I'm using above code to write and read into reg, but I'm unable to read the written values for the register.

  • Hi Rameez,

    Your command to the ADC is incorrect, please refer to my answer in another post on the E2E forum:

    ADS8689: Understanding SPI Commands

    Both ADS8675 and ADS8689 are in same ADC family and they have same commands.

    Best regards,

    Dale

  • Hi Dale LI,

    Thanks for your response.

    I'm trying to send 32 bit data into 4 bytes , where I'm wrong in it. In above code I'm trying to disable alarm function from  RST_PWRCTL_REG Register (address = 04h) by writing 0xD0040010 to it.

    And again I'm trying to read the same register by writing 0x48040000.

  • Hi Rameez,

    Apologized to make you confused.

    1. Are you able to get correct data from the ADC without programming internal registers? this can make sure your SPI timing is correct.

    2. Can you please provide the timing plots captured with an oscilloscope including /CS,SCLK,SDI and SDO?Two frames timing will be good because the data will be updated or returned in the next frame.

    Best regards,

    Dale

  • Hi Dale,

    I can now read the register data from ADC. Now I'm facing another issue how to read the analog values of the ADC, which reg i need to read in order to get the ADC output.

    Regards,

    Rameez

  • Hi Dale,

    I'm trying to configure the range sel reg(14h) and the range to 3xVref. I'm giving address 0xD0140008. While reading the same reg some times I''m the reg value correctly which is 0x00000008 but sometimes the value comes as 0x00000004. Please help me with this.

    Regards

    Rameez

  • Rameez Mulla said:

    Hi Dale,

    I'm trying to configure the range sel reg(14h) and the range to 3xVref. I'm giving address 0xD0140008. While reading the same reg some times I''m the reg value correctly which is 0x00000008 but sometimes the value comes as 0x00000004. Please help me with this.

    Regards

    Rameez

  • Hi Rameez,

    Thanks for your additional information.

    There is no register needed to read the conversion code on this ADC, please see the timing in Figure 5 and 6. Make sure you are getting correct data, then you can try to change the internal register value and read it back. I need your timing plots captured with an oscilloscope including /CS,SCLK,SDI and SDO to check whether your register writing and reading are correct or not.

    Best regards,

    Dale