SPI timming between CS and MOSI too big for application

Good day.
I am interacting between and ESP32 and an ADC (CS5523) using SPI communication. For this communication, the datsheet (CS5523 pdf, CS5523 Description, CS5523 Datasheet, CS5523 view ::: ALLDATASHEET ::: ) specifies (in page 11) that the time between the CS lowering and the SDO sending data must be a maximum of 150 [ns]. With the configuration I have, it is 1 [us]. For this I am using the Arduino incorporated library (SPI.h). My question is, how can this value be changed?, can it be changed udsing this same library?.
My code is the following:

#include <SPI.h>

#define VSPI_MISO   12   
#define VSPI_MOSI   13
#define VSPI_SCLK   14
#define M_CSb       25

static const int SPI_CLK = 1000000;
SPIClass * vspi = NULL;

void setup() {

  pinMode(M_CSb, INPUT_PULLUP);
  vspi = new SPIClass(VSPI);
  vspi->begin(VSPI_SCLK, VSPI_MISO, VSPI_MOSI, M_CSb);
  Serial.begin(9600);
  pinMode(M_CSb,OUTPUT);
  digitalWrite(M_CSb, HIGH);
}

void loop() {
  Reset(vspi);
  }

void Reset(SPIClass *spi){ 
  Serial.println("En Reset");
  spi->beginTransaction(SPISettings(SPI_CLK, MSBFIRST, SPI_MODE0));
  digitalWrite(M_CSb, LOW); // Select the slave device
  Serial.println("Se bajo el chip select Reset"); 
  spi->transfer(0x03); //Write to configuration register

  ///////// Generar reset en configuration register //////
  spi->transfer(0x00);
  spi->transfer(0x00);
  spi->transfer(0x04);


  digitalWrite(M_CSb, HIGH);  
  spi->endTransaction();
  Serial.println("Fin Reset");

Also, this is how it looks (in the atached figure)

Thanks a lot in advance

The SPI-Master (the ESP32) asserts LOW on CS/-pin to select the ADC (the Slave) and then executes the SPI.transfer(xx) command to generate SCK pulses to get data out-of-ADC. It is the Slave that is guranteed to dump 1st-bit of data on MISO-line within 150 ns time once CS/-pin goes to LOW. You have no control over it; it is auomatic. Check that when you change the input signal, the corresponding digital value changes accordingly.

Thank you very much @GolamMostafa , yes!! you are write...will check again.
Thanks alot

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.