cancel
Showing results for 
Search instead for 
Did you mean: 

Waiting for spi MISO pin change after ADC conversion

AndyJT
Associate III
Posted on November 22, 2016 at 22:35

* Have had to add text here again. Posted it last night from my tablet and this morning the post has ''no text'' ! *

Anyway, I'm trying to read an AD7190 with STM32F7 via SPI2.

Using HAL library ver 1.5.1

The issue is that the chip's data out (DOUT / MISO) also doubles up as !RDY meaning I need to setup the MISO pin for SPI, but also read the state of it. RDY signifies that an ADC conversion is complete and can be read from the serial bus.

Reading the state of the MISO pin with HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_15) does not seem to work.

How can I check the status of the SPI2 MISO pin and wait for it to go low ?

Regards,

Andy

#miso-adc
3 REPLIES 3
AndyJT
Associate III
Posted on November 23, 2016 at 09:33

Just bumping this post as it seems as though the forum lost the content of my post originally :(

Seb
ST Employee
Posted on December 10, 2016 at 19:22

If STM32 is the SPI Master, it is possible to change the GPIO dynamically from alternate function to input. Make sure to do the transition correctly. (maybe add the pull-up beforehand, check the SW sequence is glitch free on the pin).

However, in alternate mode, it should still be possible to read the input register. try to force it to ground and Vdd in debug mode and look at the GPIO IN registers in step by step mode.

Good luck!

AndyJT
Associate III
Posted on January 12, 2017 at 10:23

marsanne.sebastien

‌ Thanks for the reply. I did manage to read the GPIO when in the pin was still in SPi mode (I think I'd made a mistake in the code and was reading the wrong pin originally)

However, I didn't like this solution as it basically held up the SPI bus until that one device was ready, ie, I couldn't talk to anything else in the meantime.

In the end we picked a Texas ADC which has an additional!RDY output pin so we connected that to a dedicated GPIO input and serviced the read from an interrupt. A far better solution in my mind as the Texas was also 32-bit ADC where the Analog Devices was

Thanks

Andy