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.

ADS7028: Does SPI read register need a delay ?

Part Number: ADS7028


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

  • Hello Mouhamed, 

    Trying to debug code is difficult as there is no wholistic view.  The delay you are referring to is between telling the device to read, and the frame with the data asked for, correct? 

    Is this 10 to 100ms delay between the frames a requirement from the MCU? If so, I would suggest reaching out to the MCU support team.

    The ADC does not need this delay. based on the timing requirements of the ADC, there are some timing requirements, but not nearly as long. 

    The CS pulse duration of 200ns

    Regards

    Cynthia

  • Hello Cynthia;

    No, the 10 ms delay is not an MCU requirement. It just works when I use it between the read command and the frame with the register data.

    We measured 1.5 us pulse duration when commanding the CS pin logic level. 

    Here is my init function, could the problem come from a wrong init sequence ? 

    uint8_t ADS7028_init(ADS7028_Device* Device)
    {
    	ADS7028_Reg reg_addr;
    	uint8_t read_reg_data = 0, reg_data = 0, ADS_mask = 0;
    
    	// configure channel
    
    	// Reset
    	ADS_mask = 0x01;
    	reg_addr = ADS7028_GENERAL_CFG;
    	ADS7028_set_bit_reg(Device, reg_addr, ADS_mask);
    
    	// Clear BOR flag
    	ADS_mask = 0x01;
    	reg_addr = ADS7028_SYSTEM_STATUS;
    	ADS7028_set_bit_reg(Device, reg_addr, ADS_mask);
    	// Configure conversion modes
    		// Manual
    		// Sequence
    		// Autonomous TODO
    
    	//
    }

    Regards

    Mouhamed

  • Mouhamed,

    Can you send a logic analyzer or scope shot of the communications when you do not include the delay?   Include the time base in the scope shot. The device timing requirements are in section 7.6.  You should not have to add 10ms in between frames, so I suspect we may see some other timing issue.

    Art