diff --git a/.github/scripts/on-push.sh b/.github/scripts/on-push.sh index 0ca5a648fd0..b7ef92d0c86 100755 --- a/.github/scripts/on-push.sh +++ b/.github/scripts/on-push.sh @@ -68,6 +68,7 @@ if [ "$BUILD_PIO" -eq 0 ]; then FQBN_ESP32S2="espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app" FQBN_ESP32S3="espressif:esp32:esp32s3:PSRAM=opi,USBMode=default,PartitionScheme=huge_app" FQBN_ESP32C3="espressif:esp32:esp32c3:PartitionScheme=huge_app" + FQBN_ESP32C6="espressif:esp32:esp32c6:PartitionScheme=huge_app" SKETCHES_ESP32="\ $ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino\ @@ -85,6 +86,7 @@ if [ "$BUILD_PIO" -eq 0 ]; then build "esp32s3" $FQBN_ESP32S3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 build "esp32s2" $FQBN_ESP32S2 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX build "esp32c3" $FQBN_ESP32C3 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX + build "esp32c6" $FQBN_ESP32C6 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32XX build "esp32" $FQBN_ESP32 $CHUNK_INDEX $CHUNKS_CNT $SKETCHES_ESP32 else source ${SCRIPTS_DIR}/install-platformio-esp32.sh diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index 3168318ad55..97a402a562b 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -74,6 +74,7 @@ function build_sketch(){ # build_sketch [ex esp32s2_opts="PSRAM=enabled,PartitionScheme=huge_app" esp32s3_opts="PSRAM=opi,USBMode=default,PartitionScheme=huge_app" esp32c3_opts="PartitionScheme=huge_app" + esp32c6_opts="PartitionScheme=huge_app" # Select the common part of the FQBN based on the target. The rest will be # appended depending on the passed options. @@ -91,6 +92,9 @@ function build_sketch(){ # build_sketch [ex "esp32s3") fqbn="espressif:esp32:esp32s3:${options:-$esp32s3_opts}" ;; + "esp32c6") + fqbn="espressif:esp32:esp32c6:${options:-$esp32c6_opts}" + ;; esac # Make it look like a JSON array. diff --git a/.github/workflows/hil.yml b/.github/workflows/hil.yml index b6c91c289e8..89115db07df 100644 --- a/.github/workflows/hil.yml +++ b/.github/workflows/hil.yml @@ -47,7 +47,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3'] + chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6'] chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}} steps: - name: Checkout Repository @@ -71,11 +71,12 @@ jobs: - ESP32-S2 - ESP32-S3 - ESP32-C3 + - ESP32-C6 strategy: fail-fast: false matrix: - chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3'] + chip: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6'] chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}} container: image: python:3.10.1-bullseye diff --git a/.github/workflows/lib.yml b/.github/workflows/lib.yml index 6d0a0bba0f3..3d52fd63f97 100644 --- a/.github/workflows/lib.yml +++ b/.github/workflows/lib.yml @@ -36,6 +36,7 @@ jobs: - esp32s2 - esp32c3 - esp32s3 + - esp32c6 include: - target: esp32 @@ -46,6 +47,8 @@ jobs: fqbn: espressif:esp32:esp32c3 - target: esp32s3 fqbn: espressif:esp32:esp32s3 + - target: esp32c6 + fqbn: espressif:esp32:esp32c6 steps: diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 171dca109e7..fdb27d30495 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -26,6 +26,7 @@ jobs: name: Arduino ${{ matrix.chunk }} on ubuntu-latest runs-on: ubuntu-latest strategy: + fail-fast: false matrix: chunk: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] @@ -52,6 +53,7 @@ jobs: name: Arduino on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [windows-latest, macOS-latest] @@ -68,6 +70,7 @@ jobs: name: PlatformIO on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macOS-latest] diff --git a/boards.txt b/boards.txt index f6ba7853814..df2827b0343 100644 --- a/boards.txt +++ b/boards.txt @@ -29,6 +29,168 @@ menu.LORAWAN_PREAMBLE_LENGTH=LoRaWan Preamble Length ### DO NOT PUT BOARDS ABOVE THE OFFICIAL ESPRESSIF BOARDS! ### ############################################################## +esp32c6.name=ESP32C6 Dev Module +esp32c6.vid.0=0x303a +esp32c6.pid.0=0x1001 + +esp32c6.bootloader.tool=esptool_py +esp32c6.bootloader.tool.default=esptool_py + +esp32c6.upload.tool=esptool_py +esp32c6.upload.tool.default=esptool_py +esp32c6.upload.tool.network=esp_ota + +esp32c6.upload.maximum_size=1310720 +esp32c6.upload.maximum_data_size=327680 +esp32c6.upload.flags= +esp32c6.upload.extra_flags= +esp32c6.upload.use_1200bps_touch=false +esp32c6.upload.wait_for_upload_port=false + +esp32c6.serial.disableDTR=false +esp32c6.serial.disableRTS=false + +esp32c6.build.tarch=riscv32 +esp32c6.build.target=esp +esp32c6.build.mcu=esp32c6 +esp32c6.build.core=esp32 +esp32c6.build.variant=esp32c6 +esp32c6.build.board=ESP32C6_DEV +esp32c6.build.bootloader_addr=0x0 + +esp32c6.build.cdc_on_boot=0 +esp32c6.build.f_cpu=160000000L +esp32c6.build.flash_size=4MB +esp32c6.build.flash_freq=80m +esp32c6.build.flash_mode=qio +esp32c6.build.boot=qio +esp32c6.build.partitions=default +esp32c6.build.defines= + +## IDE 2.0 Seems to not update the value +esp32c6.menu.JTAGAdapter.default=Disabled +esp32c6.menu.JTAGAdapter.default.build.copy_jtag_files=0 +esp32c6.menu.JTAGAdapter.builtin=Integrated USB JTAG +esp32c6.menu.JTAGAdapter.builtin.build.openocdscript=esp32c6-builtin.cfg +esp32c6.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +esp32c6.menu.JTAGAdapter.external=FTDI Adapter +esp32c6.menu.JTAGAdapter.external.build.openocdscript=esp32c6-ftdi.cfg +esp32c6.menu.JTAGAdapter.external.build.copy_jtag_files=1 +esp32c6.menu.JTAGAdapter.bridge=ESP USB Bridge +esp32c6.menu.JTAGAdapter.bridge.build.openocdscript=esp32c6-bridge.cfg +esp32c6.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +esp32c6.menu.CDCOnBoot.default=Disabled +esp32c6.menu.CDCOnBoot.default.build.cdc_on_boot=0 +esp32c6.menu.CDCOnBoot.cdc=Enabled +esp32c6.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 + +esp32c6.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +esp32c6.menu.PartitionScheme.default.build.partitions=default +esp32c6.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +esp32c6.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +esp32c6.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +esp32c6.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +esp32c6.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +esp32c6.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +esp32c6.menu.PartitionScheme.minimal.build.partitions=minimal +esp32c6.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +esp32c6.menu.PartitionScheme.no_ota.build.partitions=no_ota +esp32c6.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +esp32c6.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +esp32c6.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +esp32c6.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +esp32c6.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +esp32c6.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +esp32c6.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +esp32c6.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +esp32c6.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +esp32c6.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +esp32c6.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +esp32c6.menu.PartitionScheme.huge_app.build.partitions=huge_app +esp32c6.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +esp32c6.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +esp32c6.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +esp32c6.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +esp32c6.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +esp32c6.menu.PartitionScheme.fatflash.build.partitions=ffat +esp32c6.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +esp32c6.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +esp32c6.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +esp32c6.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +esp32c6.menu.PartitionScheme.rainmaker=RainMaker +esp32c6.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +esp32c6.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 + +esp32c6.menu.CPUFreq.160=160MHz (WiFi) +esp32c6.menu.CPUFreq.160.build.f_cpu=160000000L +esp32c6.menu.CPUFreq.80=80MHz (WiFi) +esp32c6.menu.CPUFreq.80.build.f_cpu=80000000L +esp32c6.menu.CPUFreq.40=40MHz +esp32c6.menu.CPUFreq.40.build.f_cpu=40000000L +esp32c6.menu.CPUFreq.20=20MHz +esp32c6.menu.CPUFreq.20.build.f_cpu=20000000L +esp32c6.menu.CPUFreq.10=10MHz +esp32c6.menu.CPUFreq.10.build.f_cpu=10000000L + +esp32c6.menu.FlashMode.qio=QIO +esp32c6.menu.FlashMode.qio.build.flash_mode=dio +esp32c6.menu.FlashMode.qio.build.boot=qio +esp32c6.menu.FlashMode.dio=DIO +esp32c6.menu.FlashMode.dio.build.flash_mode=dio +esp32c6.menu.FlashMode.dio.build.boot=dio + +esp32c6.menu.FlashFreq.80=80MHz +esp32c6.menu.FlashFreq.80.build.flash_freq=80m +esp32c6.menu.FlashFreq.40=40MHz +esp32c6.menu.FlashFreq.40.build.flash_freq=40m + +esp32c6.menu.FlashSize.4M=4MB (32Mb) +esp32c6.menu.FlashSize.4M.build.flash_size=4MB +esp32c6.menu.FlashSize.8M=8MB (64Mb) +esp32c6.menu.FlashSize.8M.build.flash_size=8MB +esp32c6.menu.FlashSize.8M.build.partitions=default_8MB +esp32c6.menu.FlashSize.2M=2MB (16Mb) +esp32c6.menu.FlashSize.2M.build.flash_size=2MB +esp32c6.menu.FlashSize.2M.build.partitions=minimal +esp32c6.menu.FlashSize.16M=16MB (128Mb) +esp32c6.menu.FlashSize.16M.build.flash_size=16MB + +esp32c6.menu.UploadSpeed.921600=921600 +esp32c6.menu.UploadSpeed.921600.upload.speed=921600 +esp32c6.menu.UploadSpeed.115200=115200 +esp32c6.menu.UploadSpeed.115200.upload.speed=115200 +esp32c6.menu.UploadSpeed.256000.windows=256000 +esp32c6.menu.UploadSpeed.256000.upload.speed=256000 +esp32c6.menu.UploadSpeed.230400.windows.upload.speed=256000 +esp32c6.menu.UploadSpeed.230400=230400 +esp32c6.menu.UploadSpeed.230400.upload.speed=230400 +esp32c6.menu.UploadSpeed.460800.linux=460800 +esp32c6.menu.UploadSpeed.460800.macosx=460800 +esp32c6.menu.UploadSpeed.460800.upload.speed=460800 +esp32c6.menu.UploadSpeed.512000.windows=512000 +esp32c6.menu.UploadSpeed.512000.upload.speed=512000 + +esp32c6.menu.DebugLevel.none=None +esp32c6.menu.DebugLevel.none.build.code_debug=0 +esp32c6.menu.DebugLevel.error=Error +esp32c6.menu.DebugLevel.error.build.code_debug=1 +esp32c6.menu.DebugLevel.warn=Warn +esp32c6.menu.DebugLevel.warn.build.code_debug=2 +esp32c6.menu.DebugLevel.info=Info +esp32c6.menu.DebugLevel.info.build.code_debug=3 +esp32c6.menu.DebugLevel.debug=Debug +esp32c6.menu.DebugLevel.debug.build.code_debug=4 +esp32c6.menu.DebugLevel.verbose=Verbose +esp32c6.menu.DebugLevel.verbose.build.code_debug=5 + +esp32c6.menu.EraseFlash.none=Disabled +esp32c6.menu.EraseFlash.none.upload.erase_cmd= +esp32c6.menu.EraseFlash.all=Enabled +esp32c6.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + esp32s3.name=ESP32S3 Dev Module esp32s3.vid.0=0x303a esp32s3.pid.0=0x1001 diff --git a/cores/esp32/Esp.cpp b/cores/esp32/Esp.cpp index 92b48a251d1..ae691d01fbd 100644 --- a/cores/esp32/Esp.cpp +++ b/cores/esp32/Esp.cpp @@ -51,6 +51,9 @@ extern "C" { #elif CONFIG_IDF_TARGET_ESP32C3 #include "esp32c3/rom/spi_flash.h" #define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c3 is located at 0x0000 +#elif CONFIG_IDF_TARGET_ESP32C6 +#include "esp32c6/rom/spi_flash.h" +#define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c6 is located at 0x0000 #else #error Target CONFIG_IDF_TARGET is not supported #endif diff --git a/cores/esp32/HWCDC.cpp b/cores/esp32/HWCDC.cpp index 86a41dee38b..1d8f61a717d 100644 --- a/cores/esp32/HWCDC.cpp +++ b/cores/esp32/HWCDC.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "USB.h" -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if SOC_USB_SERIAL_JTAG_SUPPORTED #include "esp32-hal.h" #include "esp32-hal-periman.h" @@ -435,4 +435,4 @@ HWCDC USBSerial; #endif #endif -#endif /* CONFIG_TINYUSB_CDC_ENABLED */ +#endif /* SOC_USB_SERIAL_JTAG_SUPPORTED */ diff --git a/cores/esp32/HWCDC.h b/cores/esp32/HWCDC.h index fa0536f6268..b332ae80e1c 100644 --- a/cores/esp32/HWCDC.h +++ b/cores/esp32/HWCDC.h @@ -14,7 +14,9 @@ #pragma once #include "sdkconfig.h" -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#include "soc/soc_caps.h" + +#if SOC_USB_SERIAL_JTAG_SUPPORTED #include #include "esp_event.h" diff --git a/cores/esp32/HardwareSerial.cpp b/cores/esp32/HardwareSerial.cpp index f7baea0d936..90b6653a570 100644 --- a/cores/esp32/HardwareSerial.cpp +++ b/cores/esp32/HardwareSerial.cpp @@ -28,6 +28,8 @@ #define SOC_RX0 44 #elif CONFIG_IDF_TARGET_ESP32C3 #define SOC_RX0 20 +#elif CONFIG_IDF_TARGET_ESP32C6 +#define SOC_RX0 17 #endif #endif @@ -38,6 +40,8 @@ #define SOC_TX0 43 #elif CONFIG_IDF_TARGET_ESP32C3 #define SOC_TX0 21 +#elif CONFIG_IDF_TARGET_ESP32C6 +#define SOC_TX0 16 #endif #endif @@ -55,6 +59,8 @@ void serialEvent(void) {} #define RX1 18 #elif CONFIG_IDF_TARGET_ESP32S3 #define RX1 15 +#elif CONFIG_IDF_TARGET_ESP32C6 +#define RX1 5 #endif #endif @@ -67,6 +73,8 @@ void serialEvent(void) {} #define TX1 19 #elif CONFIG_IDF_TARGET_ESP32S3 #define TX1 16 +#elif CONFIG_IDF_TARGET_ESP32C6 +#define TX1 4 #endif #endif diff --git a/cores/esp32/USB.h b/cores/esp32/USB.h index 131ff6d4268..250cda13b2d 100644 --- a/cores/esp32/USB.h +++ b/cores/esp32/USB.h @@ -13,9 +13,9 @@ // limitations under the License. #pragma once -#include "sdkconfig.h" +#include "soc/soc_caps.h" -#if CONFIG_TINYUSB_ENABLED +#if SOC_USB_OTG_SUPPORTED #include "esp_event.h" #include "USBCDC.h" @@ -116,4 +116,4 @@ class ESPUSB { extern ESPUSB USB; -#endif /* CONFIG_TINYUSB_ENABLED */ +#endif /* SOC_USB_OTG_SUPPORTED */ diff --git a/cores/esp32/esp32-hal-adc.c b/cores/esp32/esp32-hal-adc.c index dc3c1815535..608d35f477c 100644 --- a/cores/esp32/esp32-hal-adc.c +++ b/cores/esp32/esp32-hal-adc.c @@ -91,7 +91,7 @@ esp_err_t __analogChannelConfig(adc_bitwidth_t width, adc_attenuation_t atten, i log_e("adc_cali_create_scheme_curve_fitting failed with error: %d", err); return err; } - #else //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED + #elif !defined(CONFIG_IDF_TARGET_ESP32C6) //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED log_d("Deleting ADC_UNIT_%d line cali handle",adc_unit); err = adc_cali_delete_scheme_line_fitting(adc_cali_handle[adc_unit]); if(err != ESP_OK){ @@ -278,7 +278,7 @@ uint32_t __analogReadMilliVolts(uint8_t pin){ .bitwidth = __analogWidth, }; err = adc_cali_create_scheme_curve_fitting(&cali_config, &adc_cali_handle[adc_unit]); - #else //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED + #elif !defined(CONFIG_IDF_TARGET_ESP32C6) //ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED adc_cali_line_fitting_config_t cali_config = { .unit_id = adc_unit, .bitwidth = __analogWidth, diff --git a/cores/esp32/esp32-hal-cpu.c b/cores/esp32/esp32-hal-cpu.c index 925b8d8b5cd..9163bc36d6b 100644 --- a/cores/esp32/esp32-hal-cpu.c +++ b/cores/esp32/esp32-hal-cpu.c @@ -19,8 +19,10 @@ #include "esp_attr.h" #include "esp_log.h" #include "soc/rtc.h" +#ifndef CONFIG_IDF_TARGET_ESP32C6 #include "soc/rtc_cntl_reg.h" #include "soc/apb_ctrl_reg.h" +#endif #include "soc/efuse_reg.h" #include "esp32-hal.h" #include "esp32-hal-cpu.h" @@ -38,6 +40,8 @@ #include "esp32s3/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32C3 #include "esp32c3/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C6 +#include "esp32c6/rom/rtc.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -147,7 +151,7 @@ bool removeApbChangeCallback(void * arg, apb_change_cb_t cb){ } static uint32_t calculateApb(rtc_cpu_freq_config_t * conf){ -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 return APB_CLK_FREQ; #else if(conf->freq_mhz >= 80){ @@ -218,6 +222,7 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz){ } //Make the frequency change rtc_clk_cpu_freq_set_config_fast(&conf); +#ifndef CONFIG_IDF_TARGET_ESP32C6 if(capb != apb){ //Update REF_TICK (uncomment if REF_TICK is different than 1MHz) //if(conf.freq_mhz < 80){ @@ -228,8 +233,9 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz){ //Update esp_timer divisor esp_timer_impl_update_apb_freq(apb / MHZ); } +#endif //Update FreeRTOS Tick Divisor -#if CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 #elif CONFIG_IDF_TARGET_ESP32S3 diff --git a/cores/esp32/esp32-hal-i2c-slave.c b/cores/esp32/esp32-hal-i2c-slave.c index 7e64b4d817d..d4bff885cac 100644 --- a/cores/esp32/esp32-hal-i2c-slave.c +++ b/cores/esp32/esp32-hal-i2c-slave.c @@ -165,7 +165,7 @@ static inline void i2c_ll_stretch_clr(i2c_dev_t *hw) static inline bool i2c_ll_slave_addressed(i2c_dev_t *hw) { -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 return hw->sr.slave_addressed; #else return hw->status_reg.slave_addressed; @@ -174,7 +174,7 @@ static inline bool i2c_ll_slave_addressed(i2c_dev_t *hw) static inline bool i2c_ll_slave_rw(i2c_dev_t *hw)//not exposed by hal_ll { -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 return hw->sr.slave_rw; #else return hw->status_reg.slave_rw; diff --git a/cores/esp32/esp32-hal-log.h b/cores/esp32/esp32-hal-log.h index 3198387fdd8..15f986400b4 100644 --- a/cores/esp32/esp32-hal-log.h +++ b/cores/esp32/esp32-hal-log.h @@ -90,6 +90,8 @@ void log_print_buf(const uint8_t *b, size_t len); #define ARDUHAL_SHORT_LOG_FORMAT(letter, format) ARDUHAL_LOG_COLOR_ ## letter format ARDUHAL_LOG_RESET_COLOR "\r\n" #define ARDUHAL_LOG_FORMAT(letter, format) ARDUHAL_LOG_COLOR_ ## letter "[%6u][" #letter "][%s:%u] %s(): " format ARDUHAL_LOG_RESET_COLOR "\r\n", (unsigned long) (esp_timer_get_time() / 1000ULL), pathToFileName(__FILE__), __LINE__, __FUNCTION__ +//esp_rom_printf(DRAM_STR("ST:%d\n"), frame_pos); + #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE #ifndef USE_ESP_IDF_LOG #define log_v(format, ...) log_printf(ARDUHAL_LOG_FORMAT(V, format), ##__VA_ARGS__) diff --git a/cores/esp32/esp32-hal-matrix.c b/cores/esp32/esp32-hal-matrix.c index 869761a9ac7..0e0d71bdf89 100644 --- a/cores/esp32/esp32-hal-matrix.c +++ b/cores/esp32/esp32-hal-matrix.c @@ -25,6 +25,8 @@ #include "esp32s3/rom/gpio.h" #elif CONFIG_IDF_TARGET_ESP32C3 #include "esp32c3/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32C6 +#include "esp32c6/rom/gpio.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 78948b9ac07..f7ff9612ba9 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -29,8 +29,10 @@ #endif //CONFIG_BT_ENABLED #include #include "soc/rtc.h" +#ifndef CONFIG_IDF_TARGET_ESP32C6 #include "soc/rtc_cntl_reg.h" #include "soc/apb_ctrl_reg.h" +#endif #include "esp_task_wdt.h" #include "esp32-hal.h" @@ -47,6 +49,9 @@ #elif CONFIG_IDF_TARGET_ESP32C3 #include "esp32c3/rom/rtc.h" #include "driver/temperature_sensor.h" +#elif CONFIG_IDF_TARGET_ESP32C6 +#include "esp32c6/rom/rtc.h" +#include "driver/temperature_sensor.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif diff --git a/cores/esp32/esp32-hal-rmt.c b/cores/esp32/esp32-hal-rmt.c index ec1cf7b59bb..6f6c6445f1a 100644 --- a/cores/esp32/esp32-hal-rmt.c +++ b/cores/esp32/esp32-hal-rmt.c @@ -478,7 +478,8 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ // TX Channel rmt_tx_channel_config_t tx_cfg; tx_cfg.gpio_num = pin; - tx_cfg.clk_src = RMT_CLK_SRC_APB; + // CLK_APB for ESP32|S2|S3|C3 -- CLK_PLL_F80M for C6 -- CLK_XTAL for H2 + tx_cfg.clk_src = RMT_CLK_SRC_DEFAULT; tx_cfg.resolution_hz = frequency_Hz; tx_cfg.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL * mem_size; tx_cfg.trans_queue_depth = 10; // maximum allowed @@ -503,7 +504,8 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_ // RX Channel rmt_rx_channel_config_t rx_cfg; rx_cfg.gpio_num = pin; - rx_cfg.clk_src = RMT_CLK_SRC_APB; + // CLK_APB for ESP32|S2|S3|C3 -- CLK_PLL_F80M for C6 -- CLK_XTAL for H2 + rx_cfg.clk_src = RMT_CLK_SRC_DEFAULT; rx_cfg.resolution_hz = frequency_Hz; rx_cfg.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL * mem_size; rx_cfg.flags.invert_in = 0; diff --git a/cores/esp32/esp32-hal-spi.c b/cores/esp32/esp32-hal-spi.c index 807b47ab4d5..839398bf31c 100644 --- a/cores/esp32/esp32-hal-spi.c +++ b/cores/esp32/esp32-hal-spi.c @@ -27,6 +27,7 @@ #include "esp32-hal-periman.h" #include "esp_system.h" + #ifdef ESP_IDF_VERSION_MAJOR // IDF 4+ #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 #include "soc/dport_reg.h" @@ -47,6 +48,10 @@ #include "esp32c3/rom/ets_sys.h" #include "esp32c3/rom/gpio.h" #include "esp_intr_alloc.h" +#elif CONFIG_IDF_TARGET_ESP32C6 +#include "esp32c6/rom/ets_sys.h" +#include "esp32c6/rom/gpio.h" +#include "esp_intr_alloc.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -93,7 +98,7 @@ struct spi_struct_t { #define SPI_FSPI_SS_IDX(n) ((n==0)?FSPICS0_OUT_IDX:((n==1)?FSPICS1_OUT_IDX:0)) #define SPI_SS_IDX(p, n) ((p==0)?SPI_FSPI_SS_IDX(n):((p==1)?SPI_HSPI_SS_IDX(n):0)) -#elif CONFIG_IDF_TARGET_ESP32C3 +#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 // ESP32C3 #define SPI_COUNT (1) @@ -133,6 +138,8 @@ static spi_t _spi_bus_array[] = { {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), 1, -1, -1, -1, -1} #elif CONFIG_IDF_TARGET_ESP32C3 {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1} +#elif CONFIG_IDF_TARGET_ESP32C6 + {(spi_dev_t *)(DR_REG_SPI2_BASE), 0, -1, -1, -1, -1} #else {(volatile spi_dev_t *)(DR_REG_SPI0_BASE), 0, -1, -1, -1, -1}, {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), 1, -1, -1, -1, -1}, @@ -154,6 +161,8 @@ static spi_t _spi_bus_array[] = { {(volatile spi_dev_t *)(DR_REG_SPI3_BASE), NULL, 1, -1, -1, -1, -1} #elif CONFIG_IDF_TARGET_ESP32C3 {(volatile spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1} +#elif CONFIG_IDF_TARGET_ESP32C6 + {(spi_dev_t *)(DR_REG_SPI2_BASE), NULL, 0, -1, -1, -1, -1} #else {(volatile spi_dev_t *)(DR_REG_SPI0_BASE), NULL, 0, -1, -1, -1, -1}, {(volatile spi_dev_t *)(DR_REG_SPI1_BASE), NULL, 1, -1, -1, -1, -1}, @@ -329,7 +338,7 @@ void spiEnableSSPins(spi_t * spi, uint8_t cs_mask) return; } SPI_MUTEX_LOCK(); -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.val &= ~(cs_mask & SPI_CS_MASK_ALL); #else spi->dev->pin.val &= ~(cs_mask & SPI_CS_MASK_ALL); @@ -343,7 +352,7 @@ void spiDisableSSPins(spi_t * spi, uint8_t cs_mask) return; } SPI_MUTEX_LOCK(); -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.val |= (cs_mask & SPI_CS_MASK_ALL); #else spi->dev->pin.val |= (cs_mask & SPI_CS_MASK_ALL); @@ -379,7 +388,7 @@ void spiSSSet(spi_t * spi) return; } SPI_MUTEX_LOCK(); -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.cs_keep_active = 1; #else spi->dev->pin.cs_keep_active = 1; @@ -393,7 +402,7 @@ void spiSSClear(spi_t * spi) return; } SPI_MUTEX_LOCK(); -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.cs_keep_active = 0; #else spi->dev->pin.cs_keep_active = 0; @@ -424,7 +433,7 @@ uint8_t spiGetDataMode(spi_t * spi) if(!spi) { return 0; } -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 bool idleEdge = spi->dev->misc.ck_idle_edge; #else bool idleEdge = spi->dev->pin.ck_idle_edge; @@ -450,7 +459,7 @@ void spiSetDataMode(spi_t * spi, uint8_t dataMode) SPI_MUTEX_LOCK(); switch (dataMode) { case SPI_MODE1: -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.ck_idle_edge = 0; #else spi->dev->pin.ck_idle_edge = 0; @@ -458,7 +467,7 @@ void spiSetDataMode(spi_t * spi, uint8_t dataMode) spi->dev->user.ck_out_edge = 1; break; case SPI_MODE2: -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.ck_idle_edge = 1; #else spi->dev->pin.ck_idle_edge = 1; @@ -466,7 +475,7 @@ void spiSetDataMode(spi_t * spi, uint8_t dataMode) spi->dev->user.ck_out_edge = 1; break; case SPI_MODE3: -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.ck_idle_edge = 1; #else spi->dev->pin.ck_idle_edge = 1; @@ -475,7 +484,7 @@ void spiSetDataMode(spi_t * spi, uint8_t dataMode) break; case SPI_MODE0: default: -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.ck_idle_edge = 0; #else spi->dev->pin.ck_idle_edge = 0; @@ -528,7 +537,7 @@ static void spiInitBus(spi_t * spi) spi->dev->slave.trans_done = 0; #endif spi->dev->slave.val = 0; -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.val = 0; #else spi->dev->pin.val = 0; @@ -609,27 +618,33 @@ spi_t * spiStartBus(uint8_t spi_num, uint32_t clockDiv, uint8_t dataMode, uint8_ DPORT_SET_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_SPI01_CLK_EN); DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_SPI01_RST); } -#elif CONFIG_IDF_TARGET_ESP32C3 +#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 periph_ll_reset( PERIPH_SPI2_MODULE ); periph_ll_enable_clk_clear_rst( PERIPH_SPI2_MODULE ); #endif SPI_MUTEX_LOCK(); spiInitBus(spi); -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->clk_gate.clk_en = 1; spi->dev->clk_gate.mst_clk_sel = 1; spi->dev->clk_gate.mst_clk_active = 1; +#if ! CONFIG_IDF_TARGET_ESP32C6 spi->dev->dma_conf.tx_seg_trans_clr_en = 1; spi->dev->dma_conf.rx_seg_trans_clr_en = 1; spi->dev->dma_conf.dma_seg_trans_en = 0; +#endif #endif spi->dev->user.usr_mosi = 1; spi->dev->user.usr_miso = 1; spi->dev->user.doutdin = 1; int i; for(i=0; i<16; i++) { + #if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[i].val = 0x00000000; + #else spi->dev->data_buf[i] = 0x00000000; + #endif } SPI_MUTEX_UNLOCK(); @@ -653,7 +668,7 @@ void spiWaitReady(spi_t * spi) #if CONFIG_IDF_TARGET_ESP32S2 #define usr_mosi_dbitlen usr_mosi_bit_len #define usr_miso_dbitlen usr_miso_bit_len -#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 #define usr_mosi_dbitlen ms_data_bitlen #define usr_miso_dbitlen ms_data_bitlen #define mosi_dlen ms_dlen @@ -675,9 +690,13 @@ void spiWrite(spi_t * spi, const uint32_t *data, uint8_t len) spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif for(i=0; idev->data_buf[i].val = data[i]; +#else spi->dev->data_buf[i] = data[i]; +#endif } -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -699,16 +718,24 @@ void spiTransfer(spi_t * spi, uint32_t *data, uint8_t len) spi->dev->mosi_dlen.usr_mosi_dbitlen = (len * 32) - 1; spi->dev->miso_dlen.usr_miso_dbitlen = (len * 32) - 1; for(i=0; idev->data_buf[i].val = data[i]; +#else spi->dev->data_buf[i] = data[i]; +#endif } -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif spi->dev->cmd.usr = 1; while(spi->dev->cmd.usr); for(i=0; idev->data_buf[i]; +#if CONFIG_IDF_TARGET_ESP32C6 + data[i] = spi->dev->data_buf[i].val; +#else + data[i] = spi->dev->data_buf[i]; +#endif } SPI_MUTEX_UNLOCK(); } @@ -723,8 +750,13 @@ void spiWriteByte(spi_t * spi, uint8_t data) #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif + +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -741,14 +773,22 @@ uint8_t spiTransferByte(spi_t * spi, uint8_t data) SPI_MUTEX_LOCK(); spi->dev->mosi_dlen.usr_mosi_dbitlen = 7; spi->dev->miso_dlen.usr_miso_dbitlen = 7; +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif spi->dev->cmd.usr = 1; while(spi->dev->cmd.usr); +#if CONFIG_IDF_TARGET_ESP32C6 + data = spi->dev->data_buf[0].val & 0xFF; +#else data = spi->dev->data_buf[0] & 0xFF; +#endif SPI_MUTEX_UNLOCK(); return data; } @@ -776,8 +816,12 @@ void spiWriteWord(spi_t * spi, uint16_t data) #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -797,14 +841,22 @@ uint16_t spiTransferWord(spi_t * spi, uint16_t data) SPI_MUTEX_LOCK(); spi->dev->mosi_dlen.usr_mosi_dbitlen = 15; spi->dev->miso_dlen.usr_miso_dbitlen = 15; +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif spi->dev->cmd.usr = 1; while(spi->dev->cmd.usr); +#if CONFIG_IDF_TARGET_ESP32C6 + data = spi->dev->data_buf[0].val; +#else data = spi->dev->data_buf[0]; +#endif SPI_MUTEX_UNLOCK(); if(!spi->dev->ctrl.rd_bit_order){ data = (data >> 8) | (data << 8); @@ -825,8 +877,12 @@ void spiWriteLong(spi_t * spi, uint32_t data) #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -846,14 +902,22 @@ uint32_t spiTransferLong(spi_t * spi, uint32_t data) SPI_MUTEX_LOCK(); spi->dev->mosi_dlen.usr_mosi_dbitlen = 31; spi->dev->miso_dlen.usr_miso_dbitlen = 31; +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif spi->dev->cmd.usr = 1; while(spi->dev->cmd.usr); +#if CONFIG_IDF_TARGET_ESP32C6 + data = spi->dev->data_buf[0].val; +#else data = spi->dev->data_buf[0]; +#endif SPI_MUTEX_UNLOCK(); if(!spi->dev->ctrl.rd_bit_order){ data = __spiTranslate32(data); @@ -887,10 +951,14 @@ static void __spiTransferBytes(spi_t * spi, const uint8_t * data, uint8_t * out, spi->dev->miso_dlen.usr_miso_dbitlen = ((bytes * 8) - 1); for(i=0; idev->data_buf[i].val = wordsBuf[i]; //copy buffer to spi fifo + #else spi->dev->data_buf[i] = wordsBuf[i]; //copy buffer to spi fifo + #endif } -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -900,7 +968,11 @@ static void __spiTransferBytes(spi_t * spi, const uint8_t * data, uint8_t * out, if(out) { for(i=0; idev->data_buf[i].val;//copy spi fifo to buffer + #else wordsBuf[i] = spi->dev->data_buf[i];//copy spi fifo to buffer + #endif } memcpy(out, bytesBuf, bytes);//copy buffer to output } @@ -958,7 +1030,7 @@ void spiTransaction(spi_t * spi, uint32_t clockDiv, uint8_t dataMode, uint8_t bi spi->dev->clock.val = clockDiv; switch (dataMode) { case SPI_MODE1: -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.ck_idle_edge = 0; #else spi->dev->pin.ck_idle_edge = 0; @@ -966,7 +1038,7 @@ void spiTransaction(spi_t * spi, uint32_t clockDiv, uint8_t dataMode, uint8_t bi spi->dev->user.ck_out_edge = 1; break; case SPI_MODE2: -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.ck_idle_edge = 1; #else spi->dev->pin.ck_idle_edge = 1; @@ -974,7 +1046,7 @@ void spiTransaction(spi_t * spi, uint32_t clockDiv, uint8_t dataMode, uint8_t bi spi->dev->user.ck_out_edge = 1; break; case SPI_MODE3: -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.ck_idle_edge = 1; #else spi->dev->pin.ck_idle_edge = 1; @@ -983,7 +1055,7 @@ void spiTransaction(spi_t * spi, uint32_t clockDiv, uint8_t dataMode, uint8_t bi break; case SPI_MODE0: default: -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->misc.ck_idle_edge = 0; #else spi->dev->pin.ck_idle_edge = 0; @@ -1025,8 +1097,12 @@ void ARDUINO_ISR_ATTR spiWriteByteNL(spi_t * spi, uint8_t data) #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -1041,14 +1117,22 @@ uint8_t spiTransferByteNL(spi_t * spi, uint8_t data) } spi->dev->mosi_dlen.usr_mosi_dbitlen = 7; spi->dev->miso_dlen.usr_miso_dbitlen = 7; +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif spi->dev->cmd.usr = 1; while(spi->dev->cmd.usr); +#if CONFIG_IDF_TARGET_ESP32C6 + data = spi->dev->data_buf[0].val & 0xFF; +#else data = spi->dev->data_buf[0] & 0xFF; +#endif return data; } @@ -1064,8 +1148,12 @@ void ARDUINO_ISR_ATTR spiWriteShortNL(spi_t * spi, uint16_t data) #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -1083,14 +1171,22 @@ uint16_t spiTransferShortNL(spi_t * spi, uint16_t data) } spi->dev->mosi_dlen.usr_mosi_dbitlen = 15; spi->dev->miso_dlen.usr_miso_dbitlen = 15; +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif spi->dev->cmd.usr = 1; while(spi->dev->cmd.usr); +#if CONFIG_IDF_TARGET_ESP32C6 + data = spi->dev->data_buf[0].val & 0xFFFF; +#else data = spi->dev->data_buf[0] & 0xFFFF; +#endif if(!spi->dev->ctrl.rd_bit_order){ MSB_16_SET(data, data); } @@ -1109,8 +1205,12 @@ void ARDUINO_ISR_ATTR spiWriteLongNL(spi_t * spi, uint32_t data) #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32 spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -1128,14 +1228,22 @@ uint32_t spiTransferLongNL(spi_t * spi, uint32_t data) } spi->dev->mosi_dlen.usr_mosi_dbitlen = 31; spi->dev->miso_dlen.usr_miso_dbitlen = 31; +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif spi->dev->cmd.usr = 1; while(spi->dev->cmd.usr); + #if CONFIG_IDF_TARGET_ESP32C6 + data = spi->dev->data_buf[0].val; +#else data = spi->dev->data_buf[0]; +#endif if(!spi->dev->ctrl.rd_bit_order){ MSB_32_SET(data, data); } @@ -1162,9 +1270,13 @@ void spiWriteNL(spi_t * spi, const void * data_in, uint32_t len){ spi->dev->miso_dlen.usr_miso_dbitlen = 0; #endif for (size_t i=0; idev->data_buf[i].val = data[i]; + #else spi->dev->data_buf[i] = data[i]; + #endif } -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -1197,14 +1309,22 @@ void spiTransferBytesNL(spi_t * spi, const void * data_in, uint8_t * data_out, u spi->dev->miso_dlen.usr_miso_dbitlen = (c_len*8)-1; if(data){ for (size_t i=0; idev->data_buf[i].val = data[i]; + #else spi->dev->data_buf[i] = data[i]; + #endif } } else { for (size_t i=0; idev->data_buf[i].val = 0xFFFFFFFF; + #else spi->dev->data_buf[i] = 0xFFFFFFFF; + #endif } } -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -1213,9 +1333,17 @@ void spiTransferBytesNL(spi_t * spi, const void * data_in, uint8_t * data_out, u if(result){ if(c_len & 3){ for (size_t i=0; i<(c_longs-1); i++) { + #if CONFIG_IDF_TARGET_ESP32C6 + result[i] = spi->dev->data_buf[i].val; + #else result[i] = spi->dev->data_buf[i]; + #endif } - uint32_t last_data = spi->dev->data_buf[c_longs-1]; + #if CONFIG_IDF_TARGET_ESP32C6 + uint32_t last_data = spi->dev->data_buf[c_longs-1].val; + #else + uint32_t last_data = spi->dev->data_buf[c_longs-1]; + #endif uint8_t * last_out8 = (uint8_t *)&result[c_longs-1]; uint8_t * last_data8 = (uint8_t *)&last_data; for (size_t i=0; i<(c_len & 3); i++) { @@ -1223,7 +1351,11 @@ void spiTransferBytesNL(spi_t * spi, const void * data_in, uint8_t * data_out, u } } else { for (size_t i=0; idev->data_buf[i].val; + #else result[i] = spi->dev->data_buf[i]; + #endif } } } @@ -1262,14 +1394,22 @@ void spiTransferBitsNL(spi_t * spi, uint32_t data, uint32_t * out, uint8_t bits) spi->dev->mosi_dlen.usr_mosi_dbitlen = (bits - 1); spi->dev->miso_dlen.usr_miso_dbitlen = (bits - 1); +#if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[0].val = data; +#else spi->dev->data_buf[0] = data; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#endif +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif spi->dev->cmd.usr = 1; while(spi->dev->cmd.usr); + #if CONFIG_IDF_TARGET_ESP32C6 + data = spi->dev->data_buf[0].val; +#else data = spi->dev->data_buf[0]; +#endif if(out) { *out = data; if(!spi->dev->ctrl.rd_bit_order){ @@ -1306,18 +1446,34 @@ void ARDUINO_ISR_ATTR spiWritePixelsNL(spi_t * spi, const void * data_in, uint32 if(msb){ if(l_bytes && i == (c_longs - 1)){ if(l_bytes == 2){ + #if CONFIG_IDF_TARGET_ESP32C6 + MSB_16_SET(spi->dev->data_buf[i].val, data[i]); + #else MSB_16_SET(spi->dev->data_buf[i], data[i]); + #endif } else { + #if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[i].val = data[i] & 0xFF; + #else spi->dev->data_buf[i] = data[i] & 0xFF; + #endif } } else { - MSB_PIX_SET(spi->dev->data_buf[i], data[i]); + #if CONFIG_IDF_TARGET_ESP32C6 + MSB_PIX_SET(spi->dev->data_buf[i].val, data[i]); + #else + MSB_PIX_SET(spi->dev->data_buf[i], data[i]); + #endif } } else { + #if CONFIG_IDF_TARGET_ESP32C6 + spi->dev->data_buf[i].val = data[i]; + #else spi->dev->data_buf[i] = data[i]; + #endif } } -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 spi->dev->cmd.update = 1; while (spi->dev->cmd.update); #endif @@ -1343,7 +1499,7 @@ typedef union { uint32_t clkcnt_l: 6; /*it must be equal to spi_clkcnt_N.*/ uint32_t clkcnt_h: 6; /*it must be floor((spi_clkcnt_N+1)/2-1).*/ uint32_t clkcnt_n: 6; /*it is the divider of spi_clk. So spi_clk frequency is system/(spi_clkdiv_pre+1)/(spi_clkcnt_N+1)*/ -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 uint32_t clkdiv_pre: 4; /*it is pre-divider of spi_clk.*/ uint32_t reserved: 9; /*reserved*/ #else @@ -1390,7 +1546,7 @@ uint32_t spiFrequencyToClockDiv(uint32_t freq) while(calPreVari++ <= 1) { calPre = (((apb_freq / (reg.clkcnt_n + 1)) / freq) - 1) + calPreVari; -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C6 if(calPre > 0xF) { reg.clkdiv_pre = 0xF; #else diff --git a/cores/esp32/esp32-hal-spi.h b/cores/esp32/esp32-hal-spi.h index df5597a7de7..f763fd194ce 100644 --- a/cores/esp32/esp32-hal-spi.h +++ b/cores/esp32/esp32-hal-spi.h @@ -25,7 +25,7 @@ extern "C" { #define SPI_HAS_TRANSACTION -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 #define FSPI 0 #define HSPI 1 #else diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index b0eb2ce7ac4..efa618597e4 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -192,7 +192,8 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE; uart_config.rx_flow_ctrl_thresh = rxfifo_full_thrhd; uart_config.baud_rate = baudrate; - uart_config.source_clk = UART_SCLK_APB; + // CLK_APB for ESP32|S2|S3|C3 -- CLK_PLL_F40M for C2 -- CLK_PLL_F48M for H2 -- CLK_PLL_F80M for C6 + uart_config.source_clk = UART_SCLK_DEFAULT; ESP_ERROR_CHECK(uart_driver_install(uart_nr, rx_buffer_size, tx_buffer_size, 20, &(uart->uart_event_queue), 0)); ESP_ERROR_CHECK(uart_param_config(uart_nr, &uart_config)); ESP_ERROR_CHECK(uart_set_pin(uart_nr, txPin, rxPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE)); @@ -270,13 +271,13 @@ void uartSetRxInvert(uart_t* uart, bool invert) { if (uart == NULL) return; -#if 0 +#if CONFIG_IDF_TARGET_ESP32C6 // POTENTIAL ISSUE :: original code only set/reset rxd_inv bit // IDF or LL set/reset the whole inv_mask! - if (invert) - ESP_ERROR_CHECK(uart_set_line_inverse(uart->num, UART_SIGNAL_RXD_INV)); - else - ESP_ERROR_CHECK(uart_set_line_inverse(uart->num, UART_SIGNAL_INV_DISABLE)); + // if (invert) + // ESP_ERROR_CHECK(uart_set_line_inverse(uart->num, UART_SIGNAL_RXD_INV)); + // else + // ESP_ERROR_CHECK(uart_set_line_inverse(uart->num, UART_SIGNAL_INV_DISABLE)); #else // this implementation is better over IDF API because it only affects RXD @@ -677,7 +678,7 @@ void uartStartDetectBaudrate(uart_t *uart) { return; } -#ifdef CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 // ESP32-C3 requires further testing // Baud rate detection returns wrong values @@ -748,7 +749,7 @@ uartDetectBaudrate(uart_t *uart) return default_rates[i]; #else -#ifdef CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 log_e("ESP32-C3 baud rate detection is not supported."); #else log_e("ESP32-S3 baud rate detection is not supported."); diff --git a/idf_component.yml b/idf_component.yml index 9894a2ce923..536d5cf5148 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -5,6 +5,7 @@ targets: - esp32s2 - esp32s3 - esp32c3 + - esp32c6 tags: - arduino files: @@ -14,6 +15,7 @@ files: - "variants/esp32s2/**/*" - "variants/esp32s3/**/*" - "variants/esp32c3/**/*" + - "variants/esp32c6/**/*" - "libraries/**/*" - "CMakeLists.txt" - "Kconfig.projbuild" diff --git a/libraries/BluetoothSerial/examples/DiscoverConnect/.skip.esp32c6 b/libraries/BluetoothSerial/examples/DiscoverConnect/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/BluetoothSerial/examples/GetLocalMAC/.skip.esp32c6 b/libraries/BluetoothSerial/examples/GetLocalMAC/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/BluetoothSerial/examples/SerialToSerialBT/.skip.esp32c6 b/libraries/BluetoothSerial/examples/SerialToSerialBT/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/BluetoothSerial/examples/SerialToSerialBTM/.skip.esp32c6 b/libraries/BluetoothSerial/examples/SerialToSerialBTM/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/BluetoothSerial/examples/SerialToSerialBT_SSP_pairing/.skip.esp32c6 b/libraries/BluetoothSerial/examples/SerialToSerialBT_SSP_pairing/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/BluetoothSerial/examples/bt_classic_device_discovery/.skip.esp32c6 b/libraries/BluetoothSerial/examples/bt_classic_device_discovery/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/BluetoothSerial/examples/bt_remove_paired_devices/.skip.esp32c6 b/libraries/BluetoothSerial/examples/bt_remove_paired_devices/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Camera/CameraWebServer/.skip.esp32c6 b/libraries/ESP32/examples/Camera/CameraWebServer/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/.skip.esp32c6 b/libraries/ESP32/examples/DeepSleep/ExternalWakeUp/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/.skip.esp32c6 b/libraries/ESP32/examples/DeepSleep/SmoothBlink_ULP_Code/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/DeepSleep/TouchWakeUp/.skip.esp32c6 b/libraries/ESP32/examples/DeepSleep/TouchWakeUp/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/I2S/HiFreq_ADC/.skip.esp32c6 b/libraries/ESP32/examples/I2S/HiFreq_ADC/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino b/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino index b7469fc837a..7a37c78b196 100644 --- a/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino +++ b/libraries/ESP32/examples/RMT/RMTLoopback/RMTLoopback.ino @@ -21,7 +21,7 @@ * */ -#if CONFIG_IDF_TARGET_ESP32C3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 // ESP32 C3 has only 2 channels for RX and 2 for TX, thus MAX RMT_MEM is 128 #define RMT_TX_PIN 4 #define RMT_RX_PIN 5 diff --git a/libraries/ESP32/examples/ResetReason/ResetReason.ino b/libraries/ESP32/examples/ResetReason/ResetReason.ino index 3da7d400382..8fd227ad873 100644 --- a/libraries/ESP32/examples/ResetReason/ResetReason.ino +++ b/libraries/ESP32/examples/ResetReason/ResetReason.ino @@ -12,7 +12,6 @@ * Evandro Luis Copercini - 2017 */ -#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+ #if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 #include "esp32/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32S2 @@ -21,12 +20,11 @@ #include "esp32c3/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32S3 #include "esp32s3/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C6 +#include "esp32c6/rom/rtc.h" #else #error Target CONFIG_IDF_TARGET is not supported #endif -#else // ESP32 Before IDF 4.0 -#include "rom/rtc.h" -#endif #define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */ diff --git a/libraries/ESP32/examples/Touch/TouchButton/.skip.esp32c6 b/libraries/ESP32/examples/Touch/TouchButton/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Touch/TouchButtonV2/.skip.esp32c6 b/libraries/ESP32/examples/Touch/TouchButtonV2/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Touch/TouchInterrupt/.skip.esp32c6 b/libraries/ESP32/examples/Touch/TouchInterrupt/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/ESP32/examples/Touch/TouchRead/.skip.esp32c6 b/libraries/ESP32/examples/Touch/TouchRead/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/Ethernet/examples/ETH_LAN8720/.skip.esp32c6 b/libraries/Ethernet/examples/ETH_LAN8720/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/Ethernet/examples/ETH_TLK110/.skip.esp32c6 b/libraries/Ethernet/examples/ETH_TLK110/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/I2S/examples/ADCPlotter/.skip.esp32c6 b/libraries/I2S/examples/ADCPlotter/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/I2S/examples/FullDuplex/.skip.esp32c6 b/libraries/I2S/examples/FullDuplex/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/I2S/examples/InputSerialPlotter/.skip.esp32c6 b/libraries/I2S/examples/InputSerialPlotter/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/I2S/examples/SimpleTone/.skip.esp32c6 b/libraries/I2S/examples/SimpleTone/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/Insights/examples/DiagnosticsSmokeTest/.skip.esp32c6 b/libraries/Insights/examples/DiagnosticsSmokeTest/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/Insights/examples/MinimalDiagnostics/.skip.esp32c6 b/libraries/Insights/examples/MinimalDiagnostics/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/RainMaker/examples/RMakerCustom/.skip.esp32c6 b/libraries/RainMaker/examples/RMakerCustom/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/RainMaker/examples/RMakerCustomAirCooler/.skip.esp32c6 b/libraries/RainMaker/examples/RMakerCustomAirCooler/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/RainMaker/examples/RMakerSonoffDualR3/.skip.esp32c6 b/libraries/RainMaker/examples/RMakerSonoffDualR3/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/RainMaker/examples/RMakerSwitch/.skip.esp32c6 b/libraries/RainMaker/examples/RMakerSwitch/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/SD_MMC/examples/SDMMC_Test/.skip.esp32c6 b/libraries/SD_MMC/examples/SDMMC_Test/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/SD_MMC/examples/SDMMC_time/.skip.esp32c6 b/libraries/SD_MMC/examples/SDMMC_time/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/SPI/examples/SPI_Multiple_Buses/.skip.esp32c6 b/libraries/SPI/examples/SPI_Multiple_Buses/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/SPI/src/SPI.cpp b/libraries/SPI/src/SPI.cpp index c8e04f9af90..d206e6cc212 100644 --- a/libraries/SPI/src/SPI.cpp +++ b/libraries/SPI/src/SPI.cpp @@ -88,7 +88,7 @@ void SPIClass::begin(int8_t sck, int8_t miso, int8_t mosi, int8_t ss) _miso = (_spi_num == FSPI) ? MISO : -1; _mosi = (_spi_num == FSPI) ? MOSI : -1; _ss = (_spi_num == FSPI) ? SS : -1; -#elif CONFIG_IDF_TARGET_ESP32C3 +#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 _sck = SCK; _miso = MISO; _mosi = MOSI; diff --git a/libraries/USB/examples/CompositeDevice/.skip.esp32c6 b/libraries/USB/examples/CompositeDevice/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/ConsumerControl/.skip.esp32c6 b/libraries/USB/examples/ConsumerControl/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/CustomHIDDevice/.skip.esp32c6 b/libraries/USB/examples/CustomHIDDevice/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/FirmwareMSC/.skip.esp32c6 b/libraries/USB/examples/FirmwareMSC/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/Gamepad/.skip.esp32c6 b/libraries/USB/examples/Gamepad/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/HIDVendor/.skip.esp32c6 b/libraries/USB/examples/HIDVendor/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/Keyboard/KeyboardLogout/.skip.esp32c6 b/libraries/USB/examples/Keyboard/KeyboardLogout/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/Keyboard/KeyboardMessage/.skip.esp32c6 b/libraries/USB/examples/Keyboard/KeyboardMessage/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/Keyboard/KeyboardReprogram/.skip.esp32c6 b/libraries/USB/examples/Keyboard/KeyboardReprogram/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/Keyboard/KeyboardSerial/.skip.esp32c6 b/libraries/USB/examples/Keyboard/KeyboardSerial/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/KeyboardAndMouseControl/.skip.esp32c6 b/libraries/USB/examples/KeyboardAndMouseControl/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/Mouse/ButtonMouseControl/.skip.esp32c6 b/libraries/USB/examples/Mouse/ButtonMouseControl/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/SystemControl/.skip.esp32c6 b/libraries/USB/examples/SystemControl/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/USBMSC/.skip.esp32c6 b/libraries/USB/examples/USBMSC/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/USBSerial/.skip.esp32c6 b/libraries/USB/examples/USBSerial/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libraries/USB/examples/USBVendor/.skip.esp32c6 b/libraries/USB/examples/USBVendor/.skip.esp32c6 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/package/package_esp32_index.template.json b/package/package_esp32_index.template.json index b5cc9d88a08..7b82e263980 100644 --- a/package/package_esp32_index.template.json +++ b/package/package_esp32_index.template.json @@ -39,7 +39,7 @@ { "packager": "esp32", "name": "esp32-arduino-libs", - "version": "idf-release_v5.1-4bc762621d" + "version": "idf-release_v5.1-4bc762621f" }, { "packager": "esp32", @@ -97,61 +97,61 @@ "tools": [ { "name": "esp32-arduino-libs", - "version": "idf-release_v5.1-4bc762621d", + "version": "idf-release_v5.1-4bc762621f", "systems": [ { "host": "i686-mingw32", - "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/49e66a309b22f91ee5c23840be751aa30dadd83c", - "archiveFileName": "esp32-arduino-libs-49e66a309b22f91ee5c23840be751aa30dadd83c.zip", + "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/21759a1fa7bf2289fc0b6e31367a07c7bebfe303", + "archiveFileName": "esp32-arduino-libs-21759a1fa7bf2289fc0b6e31367a07c7bebfe303.zip", "checksum": "SHA-256:a586736d0d129560f14d77a2de157c496689be7c975c494aacad1d3655344845", "size": "196715296" }, { "host": "x86_64-mingw32", - "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/49e66a309b22f91ee5c23840be751aa30dadd83c", - "archiveFileName": "esp32-arduino-libs-49e66a309b22f91ee5c23840be751aa30dadd83c.zip", + "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/21759a1fa7bf2289fc0b6e31367a07c7bebfe303", + "archiveFileName": "esp32-arduino-libs-21759a1fa7bf2289fc0b6e31367a07c7bebfe303.zip", "checksum": "SHA-256:a586736d0d129560f14d77a2de157c496689be7c975c494aacad1d3655344845", "size": "196715296" }, { "host": "arm64-apple-darwin", - "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/49e66a309b22f91ee5c23840be751aa30dadd83c", - "archiveFileName": "esp32-arduino-libs-49e66a309b22f91ee5c23840be751aa30dadd83c.zip", + "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/21759a1fa7bf2289fc0b6e31367a07c7bebfe303", + "archiveFileName": "esp32-arduino-libs-21759a1fa7bf2289fc0b6e31367a07c7bebfe303.zip", "checksum": "SHA-256:a586736d0d129560f14d77a2de157c496689be7c975c494aacad1d3655344845", "size": "196715296" }, { "host": "x86_64-apple-darwin", - "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/49e66a309b22f91ee5c23840be751aa30dadd83c", - "archiveFileName": "esp32-arduino-libs-49e66a309b22f91ee5c23840be751aa30dadd83c.zip", + "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/21759a1fa7bf2289fc0b6e31367a07c7bebfe303", + "archiveFileName": "esp32-arduino-libs-21759a1fa7bf2289fc0b6e31367a07c7bebfe303.zip", "checksum": "SHA-256:a586736d0d129560f14d77a2de157c496689be7c975c494aacad1d3655344845", "size": "196715296" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/49e66a309b22f91ee5c23840be751aa30dadd83c", - "archiveFileName": "esp32-arduino-libs-49e66a309b22f91ee5c23840be751aa30dadd83c.zip", + "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/21759a1fa7bf2289fc0b6e31367a07c7bebfe303", + "archiveFileName": "esp32-arduino-libs-21759a1fa7bf2289fc0b6e31367a07c7bebfe303.zip", "checksum": "SHA-256:a586736d0d129560f14d77a2de157c496689be7c975c494aacad1d3655344845", "size": "196715296" }, { "host": "i686-pc-linux-gnu", - "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/49e66a309b22f91ee5c23840be751aa30dadd83c", - "archiveFileName": "esp32-arduino-libs-49e66a309b22f91ee5c23840be751aa30dadd83c.zip", + "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/21759a1fa7bf2289fc0b6e31367a07c7bebfe303", + "archiveFileName": "esp32-arduino-libs-21759a1fa7bf2289fc0b6e31367a07c7bebfe303.zip", "checksum": "SHA-256:a586736d0d129560f14d77a2de157c496689be7c975c494aacad1d3655344845", "size": "196715296" }, { "host": "aarch64-linux-gnu", - "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/49e66a309b22f91ee5c23840be751aa30dadd83c", - "archiveFileName": "esp32-arduino-libs-49e66a309b22f91ee5c23840be751aa30dadd83c.zip", + "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/21759a1fa7bf2289fc0b6e31367a07c7bebfe303", + "archiveFileName": "esp32-arduino-libs-21759a1fa7bf2289fc0b6e31367a07c7bebfe303.zip", "checksum": "SHA-256:a586736d0d129560f14d77a2de157c496689be7c975c494aacad1d3655344845", "size": "196715296" }, { "host": "arm-linux-gnueabihf", - "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/49e66a309b22f91ee5c23840be751aa30dadd83c", - "archiveFileName": "esp32-arduino-libs-49e66a309b22f91ee5c23840be751aa30dadd83c.zip", + "url": "https://codeload.github.com/espressif/esp32-arduino-libs/zip/21759a1fa7bf2289fc0b6e31367a07c7bebfe303", + "archiveFileName": "esp32-arduino-libs-21759a1fa7bf2289fc0b6e31367a07c7bebfe303.zip", "checksum": "SHA-256:a586736d0d129560f14d77a2de157c496689be7c975c494aacad1d3655344845", "size": "196715296" } diff --git a/platform.txt b/platform.txt index d6f3a305f0e..1403b1e7f45 100644 --- a/platform.txt +++ b/platform.txt @@ -81,6 +81,7 @@ build.extra_flags.esp32=-DARDUINO_USB_CDC_ON_BOOT=0 build.extra_flags.esp32s3=-DARDUINO_USB_MODE={build.usb_mode} -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} -DARDUINO_USB_MSC_ON_BOOT={build.msc_on_boot} -DARDUINO_USB_DFU_ON_BOOT={build.dfu_on_boot} build.extra_flags.esp32s2=-DARDUINO_USB_MODE=0 -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} -DARDUINO_USB_MSC_ON_BOOT={build.msc_on_boot} -DARDUINO_USB_DFU_ON_BOOT={build.dfu_on_boot} build.extra_flags.esp32c3=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} +build.extra_flags.esp32c6=-DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT={build.cdc_on_boot} # This can be overriden in boards.txt build.flash_size=4MB @@ -105,6 +106,7 @@ build.openocdscript.esp32=esp32-wrover-kit-3.3v.cfg build.openocdscript.esp32s2=esp32s2-kaluga-1.cfg build.openocdscript.esp32s3=esp32s3-builtin.cfg build.openocdscript.esp32c3=esp32c3-builtin.cfg +build.openocdscript.esp32c6=esp32c6-builtin.cfg build.openocdscript={build.openocdscript.{build.mcu}} # Custom build options diff --git a/variants/esp32c6/pins_arduino.h b/variants/esp32c6/pins_arduino.h new file mode 100644 index 00000000000..ab28240d4b4 --- /dev/null +++ b/variants/esp32c6/pins_arduino.h @@ -0,0 +1,39 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define EXTERNAL_NUM_INTERRUPTS 22 +#define NUM_DIGITAL_PINS 22 +#define NUM_ANALOG_INPUTS 6 + +static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+8; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN +#define RGB_BUILTIN LED_BUILTIN +#define RGB_BRIGHTNESS 64 + +#define analogInputToDigitalPin(p) (((p)