Page 1 of 1

Full-duplex SPI with cs_ena_pretrans

Posted: Mon Apr 27, 2020 11:01 am
by DurandA
Hi!

According to ESP-IDF documentation, using cs_ena_pretrans (https://docs.espressif.com/projects/esp ... _pretransE) only works on half-duplex transactions.

However, my device works in full-duplex and requires a 100 ns CS setup time ((5) from the diagram below).
timing.png
timing.png (15.75 KiB) Viewed 3523 times
timing2.png
timing2.png (23.37 KiB) Viewed 3523 times
Is this a hardware limitation or does it comes from the ESP-IDF implementation? Is there a trick to use full-duplex anyway? Should I bitbang CS?

Re: Full-duplex SPI with cs_ena_pretrans

Posted: Wed May 06, 2020 4:00 pm
by DurandA
Digging a bit, I found a comment on this https://github.com/espressif/esp-idf/bl ... #L323-L324:
The hardware looks like it would support this, but actually setting cs_ena_pretrans when transferring in full duplex mode does absolutely nothing on the ESP32.
If I interpret it correctly, that means that the ESP32 just ignore the cs_ena_pretrans in full duplex mode. Is it worthwhile to characterize it with different values or is cs_ena_pretrans just always ignored?

More interesting, this is checked in a #ifdef CONFIG_IDF_TARGET_ESP32 barrier. Does it mean that this limitation does not apply to the ESP32-S2?