This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS7038: ADS7038 SPI communication Technology inquiry

Part Number: ADS7038

Hi, support team

My customer has the questions as follow:

I made ADS7038 product in hardware and am testing the firmware.
We are currently conducting an SPI test, but we do not know whether the data received is accurate. It was designed with reference to the C code provided by TI.

STM32f103 MCU was used, and hardware was set to 8 bits, MSB First, Baud Rate 4.5 MBits/s, Clock polarity (CPOL) Low, and Clock Phase (CPHA) 1 Edge.

The data received after reading the SYSTEM_STATUS Register is 0x84. and After 50ms delay, The data received after reading the DATA_CFG Register is 0x84, As such, it comes out the same as the above register value.
Give me some help.
My program is as follows.

tCmd[0] = 0x10;
tCmd[1] = 0x00;
tCmd[2] = 0x00;

__HAL_SPI_ENABLE(&hspi1);

HAL_GPIO_WritePin(GPIOA, SPI1_CS_Pin, GPIO_PIN_RESET);
while (HAL_SPI_GetState(&hspi1)==HAL_SPI_STATE_BUSY_TX);
spi_State = HAL_SPI_Transmit(&hspi1, &tCmd[0], 3,5);
HAL_DMA_STATE_CHANGE(&hspi1);
HAL_GPIO_WritePin(GPIOA, SPI1_CS_Pin, GPIO_PIN_SET);

DWT_Delay_us(10000);

HAL_GPIO_WritePin(GPIOA, SPI1_CS_Pin, GPIO_PIN_RESET);
while (HAL_SPI_GetState(&hspi1)==HAL_SPI_STATE_BUSY_RX);
spi_State = HAL_SPI_Receive(&hspi1, &adcResp[0], 3,5);
HAL_DMA_STATE_CHANGE(&hspi1);
HAL_GPIO_WritePin(GPIOA, SPI1_CS_Pin, GPIO_PIN_SET);

DWT_Delay_us(500000);

tCmd[0] = 0x10;
tCmd[1] = 0x02;
tCmd[2] = 0x00;

__HAL_SPI_ENABLE(&hspi1);

HAL_GPIO_WritePin(GPIOA, SPI1_CS_Pin, GPIO_PIN_RESET);
while (HAL_SPI_GetState(&hspi1)==HAL_SPI_STATE_BUSY_TX);
spi_State = HAL_SPI_Transmit(&hspi1, &tCmd[0], 3,5);
HAL_DMA_STATE_CHANGE(&hspi1);
HAL_GPIO_WritePin(GPIOA, SPI1_CS_Pin, GPIO_PIN_SET);

DWT_Delay_us(10000);

HAL_GPIO_WritePin(GPIOA, SPI1_CS_Pin, GPIO_PIN_RESET);
while (HAL_SPI_GetState(&hspi1)==HAL_SPI_STATE_BUSY_RX);
spi_State = HAL_SPI_Receive(&hspi1, &adcResp[3], 3,5);
HAL_DMA_STATE_CHANGE(&hspi1);
HAL_GPIO_WritePin(GPIOA, SPI1_CS_Pin, GPIO_PIN_SET);

DWT_Delay_us(500000);

Thanks so much.

Best regards,
Yuki

  • Hello,

    The first suggestion when debugging digital communications is to probe the digital bus, this provides a visual check and easily compare the bus to what is expected. 

    Also, it is important to note that this device uses OpCodes, these are necessary to communicate with the device