fix(network): Fix Sniffer Build with SD Card

- Added sdkConfig to cover all available SoC's
 - Defaults to the official devkit with Micro SD Card Available (ESP32 ESP-WROVER-KIT)
This commit is contained in:
glmfe
2025-11-12 08:59:38 -03:00
parent b1c7498580
commit b4d7ede1c3
4 changed files with 41 additions and 15 deletions
+4 -1
View File
@@ -17,7 +17,10 @@ This example is based on console component. For more information about console,
### Hardware Required
To run this example with WiFi interface, you should have one ESP32 dev board integrated with a SD card slot (e.g. [ESP-WROVER-KIT](https://docs.espressif.com/projects/esp-idf/en/latest/hw-reference/modules-and-boards.html#esp-wrover-kit-v4-1)) or just connect [ESP32-DevKitC](https://docs.espressif.com/projects/esp-idf/en/latest/hw-reference/modules-and-boards.html#esp32-devkitc-v4) to a SD card breakout board. To run this example with Ethernet interface option, you should have one ESP32 dev board with physical layer Ethernet support (e.g. [ESP32-Ethernet-Kit](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit.html#)) or connect SPI-Ethernet module (e.g. DM9051) to your dev board.
To run this example with the WiFi interface, use an ESP32 development board with an integrated SD card slot (for example, [ESP-WROVER-KIT](https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/hw-reference/esp32/get-started-wrover-kit.html)), or connect an SD card breakout board to your dev kit. Verify that the default SD pins are available on your board; if not, update the pin assignments in the project configuration.
To run this example with the Ethernet interface, use an ESP32 development board with a physical layer Ethernet (PHY) interface (for example, [ESP32-Ethernet-Kit](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-ethernet-kit.html#)), or connect an SPI-Ethernet module (for example, DM9051) to your board.
If you want to send packets to host, make sure to connect ESP32 to some kind of [JTAG adapter](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/jtag-debugging/index.html#jtag-debugging-selecting-jtag-adapter).
#### Ethernet Pin Assignment
@@ -46,6 +46,37 @@ menu "Example Configuration"
help
Use SPI mode.
endchoice
menu "SD card pin configuration (SPI)"
depends on SNIFFER_SD_SPI_MODE
config SNIFFER_PIN_MOSI
int "MOSI GPIO number"
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
default 15
help
GPIO pin number for SPI MOSI (Master Out Slave In).
config SNIFFER_PIN_MISO
int "MISO GPIO number"
range ENV_GPIO_RANGE_MIN ENV_GPIO_IN_RANGE_MAX
default 2
help
GPIO pin number for SPI MISO (Master In Slave Out).
config SNIFFER_PIN_CLK
int "CLK GPIO number"
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
default 14
help
GPIO pin number for SPI Clock.
config SNIFFER_PIN_CS
int "CS GPIO number"
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
default 13
help
GPIO pin number for SPI Chip Select.
endmenu
config SNIFFER_MOUNT_POINT
string "SD card mount point in the filesystem"
default "/sdcard"
@@ -35,20 +35,10 @@
#endif
#if CONFIG_SNIFFER_SD_SPI_MODE
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
#define PIN_NUM_MISO 2
#define PIN_NUM_MOSI 15
#define PIN_NUM_CLK 14
#define PIN_NUM_CS 13
#elif CONFIG_IDF_TARGET_ESP32C3
#define PIN_NUM_MISO 18
#define PIN_NUM_MOSI 9
#define PIN_NUM_CLK 8
#define PIN_NUM_CS 19
#endif //CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2
#define PIN_NUM_MISO CONFIG_SNIFFER_PIN_MISO
#define PIN_NUM_MOSI CONFIG_SNIFFER_PIN_MOSI
#define PIN_NUM_CLK CONFIG_SNIFFER_PIN_CLK
#define PIN_NUM_CS CONFIG_SNIFFER_PIN_CS
#endif // CONFIG_SNIFFER_SD_SPI_MODE
static const char *TAG = "example";
@@ -0,0 +1,2 @@
# Enable SD Card Interface.
CONFIG_SNIFFER_SD_SPI_MODE=y