Page 1 of 1

3-Wire-SPI on ESP32-WROOM-32UE

Posted: Fri Oct 13, 2023 10:43 am
by nirvik
How to perform 3-Wire-SPI communication on ESP32-WROOM-32UE ? We're using AD7091R sensor.

Re: 3-Wire-SPI on ESP32-WROOM-32UE

Posted: Sat Oct 14, 2023 7:32 am
by mikemoy
Just dont use the 4'th wire

Re: 3-Wire-SPI on ESP32-WROOM-32UE

Posted: Sat Oct 14, 2023 10:13 am
by bidrohini
Unfortunately, very less number of contents are available in this topic. I could only find this.
https://electronics.stackexchange.com/q ... i-to-esp32

Re: 3-Wire-SPI on ESP32-WROOM-32UE

Posted: Sat Oct 14, 2023 9:42 pm
by username
When you initialise your SPI bus. just set the MOSI to -1.

Code: Select all

    // spi_bus_config_t
	buscfg.sclk_io_num = PIN_NUM_CLK; 		// GPIO pin for Spi CLocK signal, or -1 if not used.
	buscfg.mosi_io_num = -1; 					// GPIO pin for Master Out Slave In (=spi_d) signal, or -1 if not used.
	buscfg.miso_io_num = PIN_NUM_MISO; 		// GPIO pin for Master In Slave Out (=spi_q) signal, or -1 if not used.O
	buscfg.quadwp_io_num = -1; 				// GPIO pin for WP (Write Protect) signal which is used as D2 in 4-bit 		 
        communication modes, or -1 if not used.
	buscfg.quadhd_io_num = -1; 				// GPIO pin for HD (HolD) signal which is used as D3 in 4-bit communication 
        modes, or -1 if not used.
	buscfg.max_transfer_sz = 0; // Maximum transfer size, in bytes. Defaults to 4094 if 0.
    ESP_ERROR_CHECK(spi_bus_initialize(HSPI_HOST, &buscfg, 1));