Page 1 of 1

Control the Timing of CS line ESP32 SPI

Posted: Sat Jan 26, 2019 5:16 pm
by e2738729
Hi everyone,

for the requirement of my application, I need to pull the CS pin LOW to send an 8-bit command via SPI to an ADC, delay for a minimum 7usec then receive 24-bit data via SPI from the ADC. The requirement here is that the CS pin must be low the entire process of 8-bit sending and 24-bit receiving. How do I make this work?

This is the snippet of the code:

uint8_t cmd = 0x01;
ADS1256_cmd(spi, cmd); // Read Data 0000 0001 (01h) // ********** Step 3 **********
adc_val = ADS1256_read(spi); // Collect 24-bit data

There has to be an delay of minimum 7usec between ADS1256_cmd and ADS1256_read. However, the CS pin is toggled HIGH between the SPI operation. I would like to make this pin LOW the entire time.

Thanks,

Khoi Ly

Re: Control the Timing of CS line ESP32 SPI

Posted: Sat Jan 26, 2019 11:44 pm
by loboris
Configure SPI not to use hw CS. Then control the CS line from software...