Problem in SPI Interfacing of LTC1859 with STM32F401RE
Hello,
I am using STM32F401RE microcontroller board and trying to interface LTC1859 with it. I am using STM32CUBEMX to generate code with following parameters for SPI:
Data size : 8 bits
Prescaler : 8
Clock Frequency : Changed from 84 MHz (default) to 16 MHz
First Bit : MSB first
CPOL : Low
CPHA : 2 Edge
I have configured HAL_SPI and generated the source code for ARM_V5 (keil). Following is the snippet of code used for making SPI connection between STM32 and LTC1859:
OPTION 1:
// Read Process
// 1. Pull CS or CONVST Low : ActivateHAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET);// 2. Tranfer Data Read Command on MOSIspiTxBuf[1] = 0x88;//LTC1859_CH0 | LTC1859_UNIPOLAR_MODE | LTC1859_LOW_RANGE_MODE | LTC1859_NORMAL_MODE;spiTxBuf[0] = 0x00;HAL_SPI_Transmit(&hspi1, &spiTxBuf[1], 1, 50);// 3. Receive DataHAL_SPI_Receive(&hspi1, spiRxBuf, 2, 50);// 4. Pull CS or CONVST High : DeactivateHAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET);OPTION 2:
// Read Process
// 1. Pull CS or CONVST Low : ActivateHAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET);// 2. Tranfer Data Read Command on MOSIspiTxBuf[0] = 0x88;//LTC1859_CH0 | LTC1859_UNIPOLAR_MODE | LTC1859_LOW_RANGE_MODE | LTC1859_NORMAL_MODE;spiTxBuf[1] = 0x00;HAL_SPI_TransmitReceive(&hspi1, spiTxBuf, spiRxBuf, 2, 50);// 3. Pull CS or CONVST High : DeactivateHAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET);Physical Connections are as follows:
AVDD, DVDD : Connected to 5V through 10uF (tantalum) and 0.1uF (Ceramic) capacitor
OVDD : Connected to 3.3V through 1
0uF (tantalum)
COM : Connected to GND
CH0 : Input through 1000pF Ceramic capactior
SDI : SPI1_MOSI
SDO : SPI1_MISO
SCK : SPI1_SCK
CONVST & ~RD : GPIO_PIN_9
All Grounds are common.
The problem I am facing is that the device is getting the communication lines in right format but not responding with ''correct'' data. Some garbage data keeps coming which is nowhere close to the data to be read. Any help would be appreciable.
All the necessary pictures are attached herewith.



#hal-spi #ltc1859-adc #stm32f401re-spi-keil-cubemx