I need to communicate with LTC2400 (ADC) over SPI.
Important: I need to use the clock that is internal to LTC2400, but the STM32F103 will have control over /CS.
The requirement is to use /CS as both /CS pin and GPO pin.
Similarly SDI pin needs to act both like SDI and GPI pin.
This is required because the ADC datasheet informs that one needs to first check whether the IC in in conversion state or sleep state. Besides it is required to bring back /CS to inactive as soon as the information is gathered.
After /CS is made made low if SDO of ADC goes high (/EOC = 1), then this means that conversion is in process. Instead if the ADC SDO line goes low (/EOC = 0) then it means that ADC is in sleep state and it is safe to read the ADC data out.
If /CS is kept low beyond a certain time interval the ADC starts throwing out data.
I want to use the STM32F103 SPI interrupt to capture data, but at the same time I want to carry and figure out which state (i.e.conversion or sleep) the ADC is into.
I do not want to call lengthy routines / function call like the below to change pin behavior:
GPIO_InitStructure.GPIO_Pin = LTC2440_SPI_SCK_PIN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(LTC2440_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);
please suggest an approach.
Thanks, Rajeev