commit 0ce360da20056102b099bdf868822cc8349f8cda Author: Commander1024 Date: Fri Aug 21 11:51:56 2026 +0200 Initialize ESP32-S3 smoke-test project cycling the RGB led. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f76caf --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.pio/ +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch/ +sdkconfig +sdkconfig.* +!sdkconfig.defaults +managed_components/ +compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..07e5ac5 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.16) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(PROJECT_VER "0.1.0") +project(esp32_serial_swiss_army_knife) diff --git a/README.md b/README.md new file mode 100644 index 0000000..40b682f --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# ESP32 Serial Swiss Army Knife + +Universal wireless serial adaptor firmware for the ESP32-S3. + +## Initial hardware target + +- ESP32-S3-DevKitC-1 +- ESP32-S3-WROOM-1-N16R8 module +- 16 MB flash +- 8 MB octal PSRAM + +The initial smoke-test firmware continuously sweeps the onboard addressable RGB LED through the color wheel at reduced brightness. The official ESP32-S3-DevKitC-1 v1.0 uses GPIO48 for the LED data signal, while official v1.1 boards use GPIO38. Compatible boards and clones may vary. + +## Build + +```sh +pio run +``` + +## Upload and monitor + +Connect the board's USB-to-UART port, then run: + +```sh +pio run --target upload +pio device monitor +``` + +The application logs its startup, detected PSRAM size, and configured RGB LED GPIO at 115200 baud. Expected output includes: + +```text +ESP32-S3 build-chain smoke test started +PSRAM initialized: 8388608 bytes +Sweeping the onboard RGB LED on GPIO48 +``` + +If the firmware runs but the RGB LED remains dark, verify the board revision. The project defaults to GPIO48, commonly used by DevKitC-compatible boards and official v1.0 boards. For an official v1.1 board—or another board wired that way—change `RGB_LED_GPIO` in `platformio.ini` from `48` to `38`, rebuild, and upload again. diff --git a/boards/esp32-s3-devkitc-1-n16r8.json b/boards/esp32-s3-devkitc-1-n16r8.json new file mode 100644 index 0000000..05fe61f --- /dev/null +++ b/boards/esp32-s3-devkitc-1-n16r8.json @@ -0,0 +1,44 @@ +{ + "build": { + "core": "esp32", + "extra_flags": [ + "-DARDUINO_ESP32S3_DEV", + "-DARDUINO_USB_MODE=1" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "hwids": [ + [ + "0x303A", + "0x1001" + ] + ], + "mcu": "esp32s3", + "variant": "esp32s3" + }, + "connectivity": [ + "bluetooth", + "wifi" + ], + "debug": { + "default_tool": "esp-builtin", + "onboard_tools": [ + "esp-builtin" + ], + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "espidf" + ], + "name": "Espressif ESP32-S3-DevKitC-1-N16R8 (16 MB QD, 8 MB OPI PSRAM)", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-devkitc-1/index.html", + "vendor": "Espressif" +} diff --git a/dependencies.lock b/dependencies.lock new file mode 100644 index 0000000..a39725c --- /dev/null +++ b/dependencies.lock @@ -0,0 +1,21 @@ +dependencies: + espressif/led_strip: + component_hash: 28621486f77229aaf81c71f5e15d6fbf36c2949cf11094e07090593e659e7639 + dependencies: + - name: idf + require: private + version: '>=5.0' + source: + registry_url: https://components.espressif.com/ + type: service + version: 3.0.3 + idf: + source: + type: idf + version: 5.5.0 +direct_dependencies: +- espressif/led_strip +- idf +manifest_hash: 2ec6b61acabeb38f1fa882ab16fa8e6ec2d49398e068a832250cb53a96ffa7d0 +target: esp32s3 +version: 2.0.0 diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..28591f5 --- /dev/null +++ b/platformio.ini @@ -0,0 +1,17 @@ +[platformio] +default_envs = esp32-s3-devkitc-1-n16r8 + +[env:esp32-s3-devkitc-1-n16r8] +platform = platformio/espressif32@6.12.0 +board = esp32-s3-devkitc-1-n16r8 +framework = espidf + +board_build.flash_mode = qio +board_build.flash_size = 16MB +board_upload.flash_size = 16MB + +build_flags = + -D RGB_LED_GPIO=48 + +monitor_speed = 115200 +monitor_filters = esp32_exception_decoder diff --git a/sdkconfig.defaults b/sdkconfig.defaults new file mode 100644 index 0000000..01c3903 --- /dev/null +++ b/sdkconfig.defaults @@ -0,0 +1,10 @@ +# ESP32-S3-WROOM-1-N16R8 hardware configuration +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_USE_CAPS_ALLOC=y + +# Keep the initial smoke-test output concise but useful. +CONFIG_LOG_DEFAULT_LEVEL_INFO=y diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..0c05b5f --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register( + SRCS "main.c" + INCLUDE_DIRS "." +) diff --git a/src/idf_component.yml b/src/idf_component.yml new file mode 100644 index 0000000..745f085 --- /dev/null +++ b/src/idf_component.yml @@ -0,0 +1,5 @@ +version: "0.1.0" +description: ESP32 Serial Swiss Army Knife application +dependencies: + idf: ">=5.3.0" + espressif/led_strip: "^3.0.3" diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..ef04b1e --- /dev/null +++ b/src/main.c @@ -0,0 +1,74 @@ +#include + +#include "esp_err.h" +#include "esp_log.h" +#include "esp_psram.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "led_strip.h" +#include "led_strip_rmt.h" + +#ifndef RGB_LED_GPIO +#define RGB_LED_GPIO 48 +#endif + +#define RGB_LED_COUNT 1 +#define RGB_LED_BRIGHTNESS 32 +#define FADE_STEP_DELAY_MS 20 + +static const char *TAG = "rgb_smoke_test"; + +static led_strip_handle_t configure_rgb_led(void) +{ + const led_strip_config_t strip_config = { + .strip_gpio_num = RGB_LED_GPIO, + .max_leds = RGB_LED_COUNT, + .led_model = LED_MODEL_WS2812, + .color_component_format = LED_STRIP_COLOR_COMPONENT_FMT_GRB, + .flags = { + .invert_out = false, + }, + }; + + const led_strip_rmt_config_t rmt_config = { + .clk_src = RMT_CLK_SRC_DEFAULT, + .resolution_hz = 10 * 1000 * 1000, + .mem_block_symbols = 0, + .flags = { + .with_dma = false, + }, + }; + + led_strip_handle_t strip = NULL; + ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &strip)); + ESP_ERROR_CHECK(led_strip_clear(strip)); + + return strip; +} + +void app_main(void) +{ + ESP_LOGI(TAG, "ESP32-S3 build-chain smoke test started"); + + if (esp_psram_is_initialized()) { + ESP_LOGI(TAG, "PSRAM initialized: %u bytes", (unsigned int)esp_psram_get_size()); + } else { + ESP_LOGW(TAG, "PSRAM is not initialized"); + } + + led_strip_handle_t strip = configure_rgb_led(); + ESP_LOGI(TAG, "Sweeping the onboard RGB LED on GPIO%d", RGB_LED_GPIO); + + while (true) { + for (uint16_t hue = 0; hue < 360; ++hue) { + ESP_ERROR_CHECK(led_strip_set_pixel_hsv( + strip, + 0, + hue, + UINT8_MAX, + RGB_LED_BRIGHTNESS)); + ESP_ERROR_CHECK(led_strip_refresh(strip)); + vTaskDelay(pdMS_TO_TICKS(FADE_STEP_DELAY_MS)); + } + } +}