AnsweredAssumed Answered

LTC1859 interfacing with STM32 Microcontroller

Question asked by ash_iuac on Jul 6, 2018
Latest reply on Jul 9, 2018 by ash_iuac

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

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 : Activate
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET);
// 2. Tranfer Data Read Command on MOSI
spiTxBuf[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 Data
HAL_SPI_Receive(&hspi1, spiRxBuf, 2, 50);
// 4. Pull CS or CONVST High : Deactivate
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_SET);

 

OPTION 2:

// Read Process
// 1. Pull CS or CONVST Low : Activate
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_9, GPIO_PIN_RESET);
// 2. Tranfer Data Read Command on MOSI
spiTxBuf[1] = 0x88;//LTC1859_CH0 | LTC1859_UNIPOLAR_MODE | LTC1859_LOW_RANGE_MODE | LTC1859_NORMAL_MODE;
spiTxBuf[0] = 0x00;
HAL_SPI_TransmitReceive(&hspi1, spiTxBuf, spiRxBuf, 2, 50);
// 3. Pull CS or CONVST High : Deactivate
HAL_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 10uF (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.

 

Thanks.

Outcomes