2017-12-07 02:37 AM
I use STM32F401CBU6 with two AD7690 in chain mode (Page 21:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD76pdf
). I connected IN AD7690 to VREF.The oscilloscope I get 11111111 11111111 10111111 11111111 11100000
But in spiData I get 11111111 11011111 11111111 01111111 11110000
uint64 spiData;
while(1) { spiData = 0; HAL_GPIO_WritePin(GPIOA, SENSOR_ADC_CVN_Pin, GPIO_PIN_SET); while(HAL_GPIO_ReadPin(GPIOB, SENSOR_ADC_MISO_Pin) == GPIO_PIN_SET); HAL_SPI_Receive(&Peripheral::spi1, (uint8*)&spiData, 5, 1000); HAL_GPIO_WritePin(GPIOA, SENSOR_ADC_CVN_Pin, GPIO_PIN_RESET);HAL_Delay(150);
}/* SPI1 init function */
void Peripheral::InitSpi1() { spi1.Instance = SPI1; spi1.Init.Mode = SPI_MODE_MASTER; spi1.Init.Direction = SPI_DIRECTION_2LINES_RXONLY; spi1.Init.DataSize = SPI_DATASIZE_8BIT; spi1.Init.CLKPolarity = SPI_POLARITY_LOW; spi1.Init.CLKPhase = SPI_PHASE_1EDGE; spi1.Init.NSS = SPI_NSS_SOFT; spi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_64; spi1.Init.FirstBit = SPI_FIRSTBIT_MSB; spi1.Init.TIMode = SPI_TIMODE_DISABLE; spi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; spi1.Init.CRCPolynomial = 7; if(HAL_SPI_Init(&spi1) != HAL_OK) { CriticalError(); } }What could be the matter? Why is this happening?