2016-11-22 01:35 PM
* 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.1The 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-adc2016-11-23 12:33 AM
Just bumping this post as it seems as though the forum lost the content of my post originally :(
2016-12-10 10:22 AM
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!
2017-01-12 02:23 AM
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