@@ -131,16 +131,19 @@ esp_err_t NF_ESP32_InitialiseEthernet(uint8_t *pMacAdr)
131
131
132
132
#elif ESP32_ETHERNET_SPI == TRUE
133
133
// Or Use SPI ethernet module
134
- // Initialise SPI bus
134
+
135
+ // Install gpio isr service for spi interupts
135
136
gpio_install_isr_service (0 );
137
+
138
+ // Initialise SPI bus
136
139
spi_bus_config_t buscfg = {0 };
137
140
buscfg.miso_io_num = ESP32_ETHERNET_SPI_MISO_GPIO;
138
141
buscfg.mosi_io_num = ESP32_ETHERNET_SPI_MOSI_GPIO;
139
142
buscfg.sclk_io_num = ESP32_ETHERNET_SPI_SCLK_GPIO;
140
143
buscfg.quadwp_io_num = -1 ;
141
144
buscfg.quadhd_io_num = -1 ;
142
145
143
- ESP_ERROR_CHECK (spi_bus_initialize (SPI2_HOST , &buscfg, 1 ));
146
+ ESP_ERROR_CHECK (spi_bus_initialize (ESP32_ETHERNET_SPI_HOST , &buscfg, SPI_DMA_CH_AUTO ));
144
147
145
148
#pragma
146
149
// Define SPI interface to use
@@ -154,7 +157,7 @@ esp_err_t NF_ESP32_InitialiseEthernet(uint8_t *pMacAdr)
154
157
.queue_size = 20 };
155
158
156
159
/* dm9051 ethernet driver is based on spi driver */
157
- eth_dm9051_config_t dm9051_config = ETH_DM9051_DEFAULT_CONFIG (CONFIG_EXAMPLE_ETH_SPI_HOST , &devcfg);
160
+ eth_dm9051_config_t dm9051_config = ETH_DM9051_DEFAULT_CONFIG (ESP32_ETHERNET_SPI_HOST , &devcfg);
158
161
dm9051_config.int_gpio_num = ESP32_ETHERNET_SPI_INT_GPIO;
159
162
esp_eth_mac_t *mac = esp_eth_mac_new_dm9051 (&dm9051_config, &mac_config);
160
163
esp_eth_phy_t *phy = esp_eth_phy_new_dm9051 (&phy_config);
@@ -172,7 +175,7 @@ esp_err_t NF_ESP32_InitialiseEthernet(uint8_t *pMacAdr)
172
175
.queue_size = 20 };
173
176
174
177
// w5500 ethernet driver is based on spi driver
175
- eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG (CONFIG_EXAMPLE_ETH_SPI_HOST , &devcfg);
178
+ eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG (ESP32_ETHERNET_SPI_HOST , &devcfg);
176
179
w5500_config.int_gpio_num = ESP32_ETHERNET_SPI_INT_GPIO;
177
180
esp_eth_mac_t *mac = esp_eth_mac_new_w5500 (&w5500_config, &mac_config);
178
181
esp_eth_phy_t *phy = esp_eth_phy_new_w5500 (&phy_config);
@@ -189,7 +192,7 @@ esp_err_t NF_ESP32_InitialiseEthernet(uint8_t *pMacAdr)
189
192
.queue_size = 20 };
190
193
191
194
// enj28j60 ethernet driver is based on spi driver
192
- eth_dm9051_config_t enj28j60_config = ETH_ENJ28J60_DEFAULT_CONFIG (CONFIG_EXAMPLE_ETH_SPI_HOST , &devcfg);
195
+ eth_dm9051_config_t enj28j60_config = ETH_ENJ28J60_DEFAULT_CONFIG (ESP32_ETHERNET_SPI_HOST , &devcfg);
193
196
enj28j60_config.int_gpio_num = ESP32_ETHERNET_SPI_INT_GPIO;
194
197
esp_eth_mac_t *mac = esp_eth_mac_new_enj28j60 (&enj28j60_config, &mac_config);
195
198
0 commit comments