Control the Timing of CS line ESP32 SPI

e2738729
Posts: 35
Joined: Mon Nov 05, 2018 6:22 pm

Control the Timing of CS line ESP32 SPI

Postby e2738729 » Sat Jan 26, 2019 5:16 pm

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

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Control the Timing of CS line ESP32 SPI

Postby loboris » Sat Jan 26, 2019 11:44 pm

Configure SPI not to use hw CS. Then control the CS line from software...

Who is online

Users browsing this forum: RichardFalk and 90 guests