title: Failing to read from an ADS8686S with an STM42F411
body: <p>I am trying to read registers from an ADS8686S ADC from TI. It has the following timing diagram for register reads (from <a href="https://www.ti.com/lit/ds/symlink/ads8686s.pdf?ts=1624204868114&amp;ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FADS8686S" rel="nofollow noreferrer">https://www.ti.com/lit/ds/symlink/ads8686s.pdf?ts=1624204868114&amp;ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FADS8686S</a>):
  <a href="https://i.stack.imgur.com/BlVIg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BlVIg.png" alt="enter image description here" /></a></p>
  <p>The device register is 0x10, with a supposed value of 0x2002.</p>
  <p>I have the following SPI initialization:</p>
  <pre><code>static void MX_SPI1_Init(void)
  {
      /* SPI1 parameter configuration*/
      hspi1.Instance = SPI1;
      hspi1.Init.Mode = SPI_MODE_MASTER;
      hspi1.Init.Direction = SPI_DIRECTION_2LINES;
      hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
      hspi1.Init.CLKPolarity = SPI_POLARITY_HIGH;
      hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
      hspi1.Init.NSS = SPI_NSS_SOFT;
      hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_64;
      hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
      hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
      hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
      hspi1.Init.CRCPolynomial = 10;
      if (HAL_SPI_Init(&amp;hspi1) != HAL_OK)
      {
          Error_Handler();
      }
  }
  </code></pre>
  <p>With the following snippet to read that register specifically:</p>
  <pre><code>// Read register device id (0x10 &lt;&lt; 9) &amp; 0xFF00
  uint8_t tx[2] = { 0x20, 0x00 };
  uint8_t rx[2] = { 0x00, 0x00 };
  
  // Send read register command
  set_adc_cs(GPIO_PIN_RESET);
  HAL_SPI_TransmitReceive(&amp;hspi1, tx, rx, 2, 1000);
  set_adc_cs(GPIO_PIN_SET);
  
  // Don't care
  HAL_SPI_TransmitReceive(&amp;hspi1, tx, rx, 2, 1000);
  
  // Receive register result
  set_adc_cs(GPIO_PIN_RESET);
  HAL_SPI_TransmitReceive(&amp;hspi1, tx, rx, 2, 1000);
  set_adc_cs(GPIO_PIN_SET);
  </code></pre>
  <p>I read back rx as { 0x00, 0x02}. Almost like I am getting half the register. Just really unsure of the issue at this point, and have been smacking my head against the wall.</p>
  <p>Is it my SPI settings, or am I misunderstanding something from the timing diagram?</p>