File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,19 @@ SpiBus::SpiBus(const std::string& _id, spi_host_device_t _host_device)
18
18
.data5_io_num = -1 ,
19
19
.data6_io_num = -1 ,
20
20
.data7_io_num = -1 ,
21
- .max_transfer_sz = SPI_MAX_DMA_LEN,
21
+ .max_transfer_sz = 0 , // defaults to SPI_MAX_DMA_LEN (=4092) or SOC_SPI_MAXIMUM_BUFFER_SIZE (=64)
22
22
.flags = 0 ,
23
23
.intr_flags = 0
24
24
};
25
- ESP_ERROR_CHECK (spi_bus_initialize (host_device, &bus_config, SPI_DMA_CH_AUTO));
25
+
26
+ #if !CONFIG_IDF_TARGET_ESP32S2
27
+ spi_dma_chan_t dma_channel = SPI_DMA_CH_AUTO;
28
+ #else
29
+ // DMA for SPI3 on ESP32-S2 is shared with ADC/DAC, so we cannot use it here
30
+ spi_dma_chan_t dma_channel = (host_device != SPI3_HOST ? SPI_DMA_CH_AUTO : SPI_DMA_DISABLED);
31
+ #endif
32
+
33
+ ESP_ERROR_CHECK (spi_bus_initialize (host_device, &bus_config, dma_channel));
26
34
}
27
35
28
36
SpiBus::~SpiBus ()
You can’t perform that action at this time.
0 commit comments