SPI Malfunction when HALF- and FULL-DUPLEX
Posted: Thu Jan 02, 2020 12:23 am
IDF version: ESP-IDF v4.1-dev-1086-g93a8603c5-dirty
Got two SPI devices: first one is adc that sends little data, but needs CS setup time before CLK ticking (so HALFDUPLEX is needed). Second is spi memory that do not need extra time but sends large blocks of data (so DMA is needed).
For first device I use HALFDUPLEX mode, no DMA, CS pretrans added. For second I use default FULLDUPLEX, DMA channel 1.
When testing any of theses devices separately, everything works. When I test them simultaneously, communication fails:
When devices use the same spi host (eg. VSPI_HOST), each receive 0xff only.
When devices use another spi hosts (eg. VSPI_HOST for adc and HSPI_HOST for memory), the device that is initialized firstly (as first do spi_bus_initialize and spi_bus_add_device) fails, receiving 0xff only.
What could be a reason?
Got two SPI devices: first one is adc that sends little data, but needs CS setup time before CLK ticking (so HALFDUPLEX is needed). Second is spi memory that do not need extra time but sends large blocks of data (so DMA is needed).
For first device I use HALFDUPLEX mode, no DMA, CS pretrans added. For second I use default FULLDUPLEX, DMA channel 1.
When testing any of theses devices separately, everything works. When I test them simultaneously, communication fails:
When devices use the same spi host (eg. VSPI_HOST), each receive 0xff only.
When devices use another spi hosts (eg. VSPI_HOST for adc and HSPI_HOST for memory), the device that is initialized firstly (as first do spi_bus_initialize and spi_bus_add_device) fails, receiving 0xff only.
What could be a reason?