From f123e3b6089b0841e83bcc67cbc2869766584eff Mon Sep 17 00:00:00 2001 From: Pawel Chojnacki Date: Sat, 11 Jan 2025 14:06:03 +0100 Subject: [PATCH] Add M5 Unit Cam S3 --- ESP32_PrusaConnectCam/mcu_cfg.h | 15 +-- .../module_ESP32-M5_Unit_CamS3.h | 103 ++++++++++++++++++ ESP32_PrusaConnectCam/module_templates.h | 5 +- 3 files changed, 115 insertions(+), 8 deletions(-) create mode 100644 ESP32_PrusaConnectCam/module_ESP32-M5_Unit_CamS3.h diff --git a/ESP32_PrusaConnectCam/mcu_cfg.h b/ESP32_PrusaConnectCam/mcu_cfg.h index a84bb2b..7ea7cc5 100644 --- a/ESP32_PrusaConnectCam/mcu_cfg.h +++ b/ESP32_PrusaConnectCam/mcu_cfg.h @@ -13,13 +13,14 @@ #define _MCU_CFG_H_ /* ----------------- CAMERA TYPE ---------------*/ -#define AI_THINKER_ESP32_CAM true -#define ESP32_WROVER_DEV false -#define CAMERA_MODEL_ESP32_S3_DEV_CAM false -#define CAMERA_MODEL_ESP32_S3_EYE_2_2 false -#define CAMERA_MODEL_XIAO_ESP32_S3_CAM false -#define CAMERA_MODEL_ESP32_S3_CAM false -#define ESP32_S3_WROOM_FREENOVE false +#define AI_THINKER_ESP32_CAM true +#define ESP32_WROVER_DEV false +#define CAMERA_MODEL_ESP32_S3_DEV_CAM false +#define CAMERA_MODEL_ESP32_S3_EYE_2_2 false +#define CAMERA_MODEL_XIAO_ESP32_S3_CAM false +#define CAMERA_MODEL_ESP32_S3_CAM false +#define ESP32_S3_WROOM_FREENOVE false +#define ESP32_M5_UNIT_CAMS3 false /* ---------------- BASIC MCU CFG --------------*/ #define SW_VERSION "1.1.2" ///< SW version diff --git a/ESP32_PrusaConnectCam/module_ESP32-M5_Unit_CamS3.h b/ESP32_PrusaConnectCam/module_ESP32-M5_Unit_CamS3.h new file mode 100644 index 0000000..881e394 --- /dev/null +++ b/ESP32_PrusaConnectCam/module_ESP32-M5_Unit_CamS3.h @@ -0,0 +1,103 @@ +/** + @file module_ESP32-M5_Unit_CamS3.h + + @brief Definition of the ESP32 M5 Unit CamS3 board + + @author Miroslav Pivovarsky + Contact: miroslav.pivovarsky@gmail.com + + Board configuration in the arduino IDE 2.3.2 + Tools -> Board -> ESP32 Arduino -> ESP32S3 Dev Module + Tools -> USB CDC on BOOT -> Disabled + Tools -> CPU Frequency -> 240MHz (WiFi/BT) + Tools -> Core debug level -> None + Tools -> USB DFU on BOOT -> Disable + Tools -> Erase all Flash Before Sketch Upload -> Disable (first flash, new board = enable. otherwise = disable) + Tools -> Events Run On -> Core 0 + Tools -> Flash Mode -> QIO 80MHz + Tools -> Flash Size -> 8MB + Tools -> Jtag Adapter -> Disable + Tools -> Arduino Runs On -> Core 0 + Tools -> USB Firmware MSC On Boot -> Disable + Tools -> Partition scheme -> Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) + Tools -> PSRAM -> OPI PSRAM + Tools -> Upload Mode -> UART0 / Hardware CDC + Tools -> Upload Speed -> 921600 + Tools -> USB Mode -> Hardware CDC and JTAG + Tools -> Zigbee mode -> Disable + + https://freenove.com/fnk0085 + + @bug: no know bug + +*/ + +#pragma once + +#include "mcu_cfg.h" + +#ifdef ESP32_M5_UNIT_CAMS3 + +/* --------------- CAMERA CFG -------------------*/ +#define PWDN_GPIO_NUM -1 ///< Power down control pin +#define RESET_GPIO_NUM -1 ///< Reset control pin +#define SIOD_GPIO_NUM 17 ///< SCCB: SI/O data pin +#define SIOC_GPIO_NUM 41 ///< SCCB: SI/O control pin +#define Y2_GPIO_NUM 6 ///< SCCB: Y2 pin +#define Y3_GPIO_NUM 15 ///< SCCB: Y3 pin +#define Y4_GPIO_NUM 16 ///< SCCB: Y4 pin +#define Y5_GPIO_NUM 7 ///< SCCB: Y5 pin +#define Y6_GPIO_NUM 5 ///< SCCB: Y6 pin +#define Y7_GPIO_NUM 10 ///< SCCB: Y7 pin +#define Y8_GPIO_NUM 4 ///< SCCB: Y8 pin +#define Y9_GPIO_NUM 13 ///< SCCB: Y9 pin +#define VSYNC_GPIO_NUM 42 ///< Vertical sync pin +#define HREF_GPIO_NUM 18 ///< Line sync pin +#define PCLK_GPIO_NUM 12 ///< Pixel clock pin +#define XCLK_GPIO_NUM 11 ///< External clock pin + +/* ------------------ MCU CFG ------------------*/ +#define BOARD_NAME F("ESP32 M5 Unit CamS3") ///< Board name +#define ENABLE_BROWN_OUT_DETECTION false ///< Enable brown out detection +#define ENABLE_PSRAM true ///< Enable PSRAM + +/* --------------- OTA UPDATE CFG --------------*/ +#define OTA_UPDATE_FW_FILE PSTR("ESP32-M5-Unit-CamS3.bin") ///< OTA update firmware file name +#define FW_STATUS_LED_PIN 14 ///< GPIO pin for status FW update LED +#define FW_STATUS_LED_LEVEL_ON LOW ///< GPIO pin level for status LED ON + +/* --------------- FLASH LED CFG ---------------*/ +#define ENABLE_CAMERA_FLASH false ///< Enable camera flash function +#define CAMERA_FLASH_DIGITAL_CTRL true ///< Enable camera flash digital control +#define CAMERA_FLASH_PWM_CTRL false ///< Enable camera flash PWM control +#define CAMERA_FLASH_NEOPIXEL true ///< Enable camera flash NeoPixel control +#define FLASH_GPIO_NUM 14 ///< Flash control pin +#define FLASH_NEOPIXEL_LED_PIN 48 ///< External flash control pin. RGB LED NeoPixel +#define FLASH_OFF_STATUS 0 ///< PWM intensity LED for OFF. 0-2^FLASH_PWM_RESOLUTION = 0-255 +#define FLASH_ON_STATUS 205 ///< PWM intensity LED for ON. limitation to 80%. 2^FLASH_PWM_RESOLUTION * 0.8% = 204 +#define FLASH_PWM_FREQ 2000 ///< frequency of pwm [240MHz / (100 prescale * pwm cycles)] = frequency +#define FLASH_PWM_CHANNEL 0 ///< channel 0 +#define FLASH_PWM_RESOLUTION 8 ///< range 1-20bit. 8bit = 0-255 range + +/* --------------- SD CARD CFG ---------------*/ +#define ENABLE_SD_CARD true ///< Enable SD card function +#define SD_PIN_CLK 39 ///< GPIO pin for SD card clock +#define SD_PIN_CMD 38 ///< GPIO pin for SD card command +#define SD_PIN_DATA0 40 ///< GPIO pin for SD card data 0 + +/* ---------- RESET CFG CONFIGURATION ----------*/ +#define CFG_RESET_PIN 0 ///< GPIO 0 is for reset CFG to default +#define CFG_RESET_LED_PIN 14 ///< GPIO for indication of reset CFG +#define CFG_RESET_LED_LEVEL_ON HIGH ///< GPIO pin level for status LED ON + +/* -------------- STATUS LED CFG ----------------*/ +#define STATUS_LED_ENABLE true ///< enable/disable status LED +#define STATUS_LED_GPIO_NUM 14 ///< GPIO pin for status LED +#define STATUS_LED_OFF_PIN_LEVEL LOW ///< GPIO pin level for status LED ON + +/* -------------- DHT SENSOR CFG ----------------*/ +#define DHT_SENSOR_ENABLE false ///< enable/disable DHT sensor +#define DHT_SENSOR_PIN 44 ///< GPIO pin for DHT sensor + +#endif // ESP32_M5_UNIT_CAMS3 +/* EOF */ \ No newline at end of file diff --git a/ESP32_PrusaConnectCam/module_templates.h b/ESP32_PrusaConnectCam/module_templates.h index cb9e25d..938e9a3 100644 --- a/ESP32_PrusaConnectCam/module_templates.h +++ b/ESP32_PrusaConnectCam/module_templates.h @@ -14,7 +14,7 @@ #include "mcu_cfg.h" -#if ((AI_THINKER_ESP32_CAM + ESP32_WROVER_DEV + CAMERA_MODEL_ESP32_S3_DEV_CAM + CAMERA_MODEL_ESP32_S3_EYE_2_2 + CAMERA_MODEL_XIAO_ESP32_S3_CAM + CAMERA_MODEL_ESP32_S3_CAM + ESP32_S3_WROOM_FREENOVE) != 1) +#if ((AI_THINKER_ESP32_CAM + ESP32_WROVER_DEV + CAMERA_MODEL_ESP32_S3_DEV_CAM + CAMERA_MODEL_ESP32_S3_EYE_2_2 + CAMERA_MODEL_XIAO_ESP32_S3_CAM + CAMERA_MODEL_ESP32_S3_CAM + ESP32_S3_WROOM_FREENOVE + ESP32_M5_UNIT_CAMS3) != 1) #error "Exactly one camera model must be defined as true." #endif @@ -39,6 +39,9 @@ #elif (true == ESP32_S3_WROOM_FREENOVE) #include "module_ESP32-S3_Wroom_Freenove.h" +#elif (true == ESP32_M5_UNIT_CAMS3) +#include "module_ESP32-M5_Unit_CamS3.h" + #else #error "No module selected"