Hello zhai_m
I am also working with stm32f407 & trying to read the ADIS16448
Since you have experience now in reading ADIS via stm32, I want to ask you if possible, to explain me what is the best configuration for reading adis output ?
I saw that you have set CPHA to 2.edge while the datasheet says 1.edge. I tried both but i couldn't give device id yet.
I have also tried to use following lines of code to read device ID but it is not successful. what changes should be done ?
Thank you in advance for your help.
address : 0x56
uint8_t ADIS_GetData(uint8_t adress)
{
GPIO_ResetBits(GPIOC, GPIO_Pin_4); // Select Device
adress = 0x8000 | adress;
while(!SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE)); //transmit buffer empty?
SPI_I2S_SendData(SPI1, adress);
while(!SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE)); //data received?
SPI_I2S_ReceiveData(SPI1); //Clear RXNE bit
do {
AD_I=GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_4);
}while(AD_I==0);
while(!SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE)); //transmit buffer empty?
SPI_I2S_SendData(SPI1, 0x00); //Dummy byte to generate clock
while(!SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE)); //data received?
GPIO_SetBits(GPIOC, GPIO_Pin_4); // De-select Device
return SPI_I2S_ReceiveData(SPI1); //return reveiced data
}