I am attempting to interface to an SPI measurement IC and read data from it.

This makes use of a "data ready" feature, which lets the microcontroller know that a measurement is complete and data is ready.

Typically on similar devices, I would find the "data ready" pin to be an additional pin from the IC which I can use as a GPIO interrupt on the MCU to signal to start reading on SPI. When this pin goes low, I need to start reading on SPI. I prefer not to do this in a polling fashion.

However, in this case, "data ready" and "data out" (MISO) is shared on the same pin (see timing diagram below). How could I handle this? Some ideas I have are:

  • Connect this pin to two pins on the MCU - have one as a GPIO interrupt, the other as MISO
  • Change the function of the pin during runtime, start it as GPIO interrupt, then configure the pin as SPI MISO, and repeat (seems unorthodox to do this)

Are there MCU SPI peripherals that handle this feature (that is, start a read when MISO changes from HIGH to LOW)?

For reference, the IC is AD7192 and I am working with the STM32L4 series MCU.

SPI Timing Diagram


1 Answer 1


There is really three options, two you already mentioned.

The only downside about the requirement of a handshake pin is that it does not really fit well into ST provided SPI HAL, as it has no feature of tranferring single bytes with any handshake. You need to anyway call the API to transfer data after each time you see the chip is ready for it.

  1. Connect the DOUT to additional GPIO pin, and use it to read status. That is simple and fast, requiring no software tricks and only one extra pin.

  2. Switch the SPI input pin as GPIO while reading the status, then switch it to SPI pin to continue with SPI.

  3. If your MCU allows it, do nothing. I've many times used an IO pin with some peripheral and it has still been possible to read the pin as GPIO. So you should try it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.