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.

ADS7886: Not Reading Properly of ADC Output

Part Number: ADS7886

Hello,

I have an external 12 bit ADC (ADS7886) on a custom designed PCB with SMT32F767. This ADC interfaces with the microprocessor with SPI. Now my problem is that I couldn't read digitized values correctly. Maybe because of the incorrect driving of the ADC or setting of SPI. Based on the ADC datasheet, I should set ADC SCK as 20 MHz, but I couldn't do that with the SPI. Because I can set only either 13.5 Mbits/s or 26 Mbits/s baudrate with the SPI (with more than 1Mbits/s clock setting, the clock signal is distorting like not exact square shapes). So how can I correctly drive ADC and read the digitized values?

Thank you

This main code:

void ADC_Conversion_of_Voltage_Transients()
{
					
		HAL_GPIO_WritePin(ADC_CS_GPIO_Port, ADC_CS_Pin, GPIO_PIN_RESET);
		HAL_SPI_Receive(&hspi4,ADC_Buf,2,100);
		HAL_GPIO_WritePin(ADC_CS_GPIO_Port, ADC_CS_Pin, GPIO_PIN_SET);
		Sample = (((uint16_t) ADC_Buf[1]) << 8 | ADC_Buf[0]);
		//Sample = 0x0 << 12 | ADC_Buf;
		volt = (float)(Sample * (5.0 / 4096.0)); // 
		testdata_in[i++]=volt;
		i %= 16;
	
}


SPI settings:

/* SPI4 init function */
static void MX_SPI4_Init(void)
{

  /* SPI4 parameter configuration*/
  hspi4.Instance = SPI4;
  hspi4.Init.Mode = SPI_MODE_MASTER;
  hspi4.Init.Direction = SPI_DIRECTION_2LINES;
  hspi4.Init.DataSize = SPI_DATASIZE_16BIT;
  hspi4.Init.CLKPolarity = SPI_POLARITY_HIGH;
  hspi4.Init.CLKPhase = SPI_PHASE_2EDGE;
  hspi4.Init.NSS = SPI_NSS_SOFT;
  hspi4.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4;
  hspi4.Init.FirstBit = SPI_FIRSTBIT_MSB;
  hspi4.Init.TIMode = SPI_TIMODE_DISABLE;
  hspi4.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
  hspi4.Init.CRCPolynomial = 7;
  hspi4.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
  hspi4.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
  if (HAL_SPI_Init(&hspi4) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }

}

I have attached the results with figures:

ADC input analog signal with yellow biphasic square waves.





ADC SCK signal with yellow plot and ADC CS signal with green plot.




ADC SCK signal with yellow plot and ADC SDO signal with green plot.



During debugging mode of the KEIL IDE, what the variables gets their values.
  • Hello,

    This device can only work with a max 20MHz clock. It will not function properly if the clock is at a higher rate than this.

    If you cannot provide a clock that meets deice requirements, then the device will not perform correctly.

    You should be able to use the 13.5Mbits/s, but this will limit the sampling rate of the device.

    Regards

    Cynthia

  • Could you explain the relationship between baudrate (13.5 Mbit/s) and sampling rate? Because I plan to use external trigger to control sampling rate.

    The other thing is that ADC directly gets its supply voltage from 5V LDO on the PCB. But in the datasheet there is explanation like "ADS7886 should be driven with a low impedance source...". So should I change the supply voltage 5V to 3.3V or doesn't matter the voltage range?

  • Baud rate is common for radio applications, and usually is found in companion with UART. 

    Since you are using SPI, which means you will be transmitting one bit per clock cycle, your baud rate is essentially your sampling rate.

    This topic can get deep very fast. I would suggest looking at the following topics independently. after that you will get a better picture

    SAR ADC sampling rate, SPI communications, and then Baud rate.

    As for the power supply, a 5V LDO is just fine, but the VDD voltage level does determine the max analog input.

    The quote you reference is talking about the analog inputs of the device, not the power supply.

    Regards

    Cynthia