Hello,
I am trying to write a simple program to ADC values. Based on the datasheet (8.3.14.2.2 Register Read), I wrote this function :
void ADS7028_spi_read_reg(ADS7028_Device* Device , ADS7028_Reg regAddr,uint8_t *pData, int8_t size)
{
uint8_t spi_reg_addr[3] = {0}, spi_reg_read[3] = {0};
spi_reg_addr[0] = 0x10;
spi_reg_addr[1] = regAddr;
spi_reg_addr[2] = 0x00;
HAL_GPIO_WritePin(Device->CS_Port, Device->CS_Pin, GPIO_PIN_RESET);
HAL_SPI_TransmitReceive(Device->hspi, spi_reg_addr, spi_reg_read, 3, HAL_MAX_DELAY);
HAL_GPIO_WritePin(Device->CS_Port, Device->CS_Pin, GPIO_PIN_SET);
HAL_Delay(20);
spi_reg_addr[0] = 0x00;
spi_reg_addr[1] = 0x00;
spi_reg_addr[2] = 0x00;
HAL_GPIO_WritePin(Device->CS_Port, Device->CS_Pin, GPIO_PIN_RESET);
HAL_SPI_TransmitReceive(Device->hspi, spi_reg_addr, spi_reg_read, 3, HAL_MAX_DELAY);
HAL_GPIO_WritePin(Device->CS_Port, Device->CS_Pin, GPIO_PIN_SET);
pData[0] = spi_reg_read[0];
pData[1] = spi_reg_read[1];
}
I am using a Nucleo 64 board with an STM32WB55. I noticed that I needed to add a delay (10 to 100 ms) before the second frame.
It is problematic for my application. Do you know if there is a way to avoid this delay ?
Thank you.
Best regards.
Mouhamed
