mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-14 06:42:34 +00:00
Compare commits
5 Commits
3b2a1547de
...
esp32-h2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f0e704f29 | ||
|
|
23aaee737a | ||
|
|
42c46cad41 | ||
|
|
f0b72a4b4b | ||
|
|
24ca4602b1 |
@@ -5,7 +5,8 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "input/InputBroker.h"
|
#include "input/InputBroker.h"
|
||||||
|
|
||||||
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(CONFIG_IDF_TARGET_ESP32C6)
|
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \
|
||||||
|
!defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||||
#include <NonBlockingRtttl.h>
|
#include <NonBlockingRtttl.h>
|
||||||
#else
|
#else
|
||||||
// Noop class for portduino.
|
// Noop class for portduino.
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("Serial
|
|||||||
api_type = TYPE_SERIAL;
|
api_type = TYPE_SERIAL;
|
||||||
}
|
}
|
||||||
static Print *serialPrint = &Serial;
|
static Print *serialPrint = &Serial;
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6) || defined(RAK3172) || defined(EBYTE_E77_MBL)
|
#elif defined(CONFIG_IDF_TARGET_ESP32C6) || defined(RAK3172) || defined(EBYTE_E77_MBL) || defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||||
SerialModule::SerialModule() : StreamAPI(&Serial1), concurrency::OSThread("Serial")
|
SerialModule::SerialModule() : StreamAPI(&Serial1), concurrency::OSThread("Serial")
|
||||||
{
|
{
|
||||||
api_type = TYPE_SERIAL;
|
api_type = TYPE_SERIAL;
|
||||||
@@ -175,7 +175,7 @@ int32_t SerialModule::runOnce()
|
|||||||
// Give it a chance to flush out 💩
|
// Give it a chance to flush out 💩
|
||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32C6)
|
#if defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||||
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
|
if (moduleConfig.serial.rxd && moduleConfig.serial.txd) {
|
||||||
Serial1.setRxBufferSize(RX_BUFFER);
|
Serial1.setRxBufferSize(RX_BUFFER);
|
||||||
Serial1.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd);
|
Serial1.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd);
|
||||||
@@ -277,7 +277,7 @@ int32_t SerialModule::runOnce()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32C6)
|
#if defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||||
while (Serial1.available()) {
|
while (Serial1.available()) {
|
||||||
serialPayloadSize = Serial1.readBytes(serialBytes, meshtastic_Constants_DATA_PAYLOAD_LEN);
|
serialPayloadSize = Serial1.readBytes(serialBytes, meshtastic_Constants_DATA_PAYLOAD_LEN);
|
||||||
#else
|
#else
|
||||||
@@ -538,7 +538,7 @@ void SerialModule::processWXSerial()
|
|||||||
{
|
{
|
||||||
#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \
|
#if !defined(TTGO_T_ECHO) && !defined(T_ECHO_LITE) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) && \
|
||||||
!defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && \
|
!defined(MESHLINK) && !defined(ELECROW_ThinkNode_M1) && !defined(ELECROW_ThinkNode_M3) && !defined(ELECROW_ThinkNode_M5) && \
|
||||||
!defined(ARCH_STM32WL) && !defined(MUZI_BASE)
|
!defined(ARCH_STM32WL) && !defined(MUZI_BASE) && !defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||||
static unsigned int lastAveraged = 0;
|
static unsigned int lastAveraged = 0;
|
||||||
static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded.
|
static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded.
|
||||||
static double dir_sum_sin = 0;
|
static double dir_sum_sin = 0;
|
||||||
|
|||||||
@@ -169,6 +169,8 @@ void esp32Setup()
|
|||||||
// #define APP_WATCHDOG_SECS 45
|
// #define APP_WATCHDOG_SECS 45
|
||||||
#define APP_WATCHDOG_SECS 90
|
#define APP_WATCHDOG_SECS 90
|
||||||
|
|
||||||
|
// esp_task_wdt_init returns an unknown error, so skip it on ESP32H2
|
||||||
|
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32C6
|
#ifdef CONFIG_IDF_TARGET_ESP32C6
|
||||||
esp_task_wdt_config_t *wdt_config = (esp_task_wdt_config_t *)malloc(sizeof(esp_task_wdt_config_t));
|
esp_task_wdt_config_t *wdt_config = (esp_task_wdt_config_t *)malloc(sizeof(esp_task_wdt_config_t));
|
||||||
wdt_config->timeout_ms = APP_WATCHDOG_SECS * 1000;
|
wdt_config->timeout_ms = APP_WATCHDOG_SECS * 1000;
|
||||||
@@ -181,7 +183,7 @@ void esp32Setup()
|
|||||||
#endif
|
#endif
|
||||||
res = esp_task_wdt_add(NULL);
|
res = esp_task_wdt_add(NULL);
|
||||||
assert(res == ESP_OK);
|
assert(res == ESP_OK);
|
||||||
|
#endif
|
||||||
#if HAS_32768HZ
|
#if HAS_32768HZ
|
||||||
enableSlowCLK();
|
enableSlowCLK();
|
||||||
#endif
|
#endif
|
||||||
@@ -223,9 +225,10 @@ void cpuDeepSleep(uint32_t msecToWake)
|
|||||||
13,
|
13,
|
||||||
#endif
|
#endif
|
||||||
34, 35, 37};
|
34, 35, 37};
|
||||||
|
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
||||||
for (int i = 0; i < sizeof(rtcGpios); i++)
|
for (int i = 0; i < sizeof(rtcGpios); i++)
|
||||||
rtc_gpio_isolate((gpio_num_t)rtcGpios[i]);
|
rtc_gpio_isolate((gpio_num_t)rtcGpios[i]);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// FIXME, disable internal rtc pullups/pulldowns on the non isolated pins. for inputs that we aren't using
|
// FIXME, disable internal rtc pullups/pulldowns on the non isolated pins. for inputs that we aren't using
|
||||||
@@ -258,10 +261,10 @@ void cpuDeepSleep(uint32_t msecToWake)
|
|||||||
|
|
||||||
#endif // #end ESP32S3_WAKE_TYPE
|
#endif // #end ESP32S3_WAKE_TYPE
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ESP_PD_DOMAIN_RTC_PERIPH
|
||||||
// We want RTC peripherals to stay on
|
// We want RTC peripherals to stay on
|
||||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
||||||
|
#endif
|
||||||
esp_sleep_enable_timer_wakeup(msecToWake * 1000ULL); // call expects usecs
|
esp_sleep_enable_timer_wakeup(msecToWake * 1000ULL); // call expects usecs
|
||||||
esp_deep_sleep_start(); // TBD mA sleep current (battery)
|
esp_deep_sleep_start(); // TBD mA sleep current (battery)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,10 +388,10 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
|||||||
uint64_t sleepUsec = sleepMsec * 1000LL;
|
uint64_t sleepUsec = sleepMsec * 1000LL;
|
||||||
|
|
||||||
// NOTE! ESP docs say we must disable bluetooth and wifi before light sleep
|
// NOTE! ESP docs say we must disable bluetooth and wifi before light sleep
|
||||||
|
#ifdef ESP_PD_DOMAIN_RTC_PERIPH
|
||||||
// We want RTC peripherals to stay on
|
// We want RTC peripherals to stay on
|
||||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
||||||
|
#endif
|
||||||
#if defined(BUTTON_PIN) && defined(BUTTON_NEED_PULLUP)
|
#if defined(BUTTON_PIN) && defined(BUTTON_NEED_PULLUP)
|
||||||
gpio_pullup_en((gpio_num_t)BUTTON_PIN);
|
gpio_pullup_en((gpio_num_t)BUTTON_PIN);
|
||||||
#endif
|
#endif
|
||||||
@@ -523,6 +523,8 @@ void enableModemSleep()
|
|||||||
esp32_config.max_freq_mhz = CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ;
|
esp32_config.max_freq_mhz = CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ;
|
||||||
#elif CONFIG_IDF_TARGET_ESP32C6
|
#elif CONFIG_IDF_TARGET_ESP32C6
|
||||||
esp32_config.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ;
|
esp32_config.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ;
|
||||||
|
#elif CONFIG_IDF_TARGET_ESP32H2
|
||||||
|
esp32_config.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ;
|
||||||
#elif CONFIG_IDF_TARGET_ESP32C3
|
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||||
esp32_config.max_freq_mhz = CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ;
|
esp32_config.max_freq_mhz = CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ;
|
||||||
#else
|
#else
|
||||||
|
|||||||
47
variants/esp32h2/esp32h2.ini
Normal file
47
variants/esp32h2/esp32h2.ini
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
[esp32h2_base]
|
||||||
|
extends = esp32_base
|
||||||
|
platform =
|
||||||
|
# Do not renovate until we have switched to pioarduino tagged builds
|
||||||
|
https://github.com/Jason2866/platform-espressif32/archive/39475a7213fa3a52b0c2048d1a31c215fc85fcf8.zip
|
||||||
|
build_flags =
|
||||||
|
${arduino_base.build_flags}
|
||||||
|
-Wall
|
||||||
|
-Wextra
|
||||||
|
-Isrc/platform/esp32
|
||||||
|
-std=c++11
|
||||||
|
-DESP_OPENSSL_SUPPRESS_LEGACY_WARNING
|
||||||
|
-DSERIAL_BUFFER_SIZE=4096
|
||||||
|
-DLIBPAX_ARDUINO
|
||||||
|
-DLIBPAX_WIFI
|
||||||
|
-DLIBPAX_BLE
|
||||||
|
-DMESHTASTIC_EXCLUDE_WEBSERVER
|
||||||
|
;-DDEBUG_HEAP
|
||||||
|
; TEMP
|
||||||
|
-DHAS_BLUETOOTH=0
|
||||||
|
-DMESHTASTIC_EXCLUDE_PAXCOUNTER
|
||||||
|
-DMESHTASTIC_EXCLUDE_BLUETOOTH
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
${arduino_base.lib_deps}
|
||||||
|
${networking_base.lib_deps}
|
||||||
|
${environmental_base.lib_deps}
|
||||||
|
${environmental_extra.lib_deps}
|
||||||
|
${radiolib_base.lib_deps}
|
||||||
|
# renovate: datasource=custom.pio depName=XPowersLib packageName=lewisxhe/library/XPowersLib
|
||||||
|
lewisxhe/XPowersLib@0.3.1
|
||||||
|
# renovate: datasource=git-refs depName=meshtastic-ESP32_Codec2 packageName=https://github.com/meshtastic/ESP32_Codec2 gitBranch=master
|
||||||
|
https://github.com/meshtastic/ESP32_Codec2/archive/633326c78ac251c059ab3a8c430fcdf25b41672f.zip
|
||||||
|
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||||
|
rweather/Crypto@0.4.0
|
||||||
|
|
||||||
|
build_src_filter =
|
||||||
|
${esp32_base.build_src_filter} -<mesh/http>
|
||||||
|
|
||||||
|
monitor_speed = 460800
|
||||||
|
monitor_filters = esp32_h2_exception_decoder
|
||||||
|
|
||||||
|
lib_ignore =
|
||||||
|
NonBlockingRTTTL
|
||||||
|
NimBLE-Arduino
|
||||||
|
libpax
|
||||||
|
|
||||||
11
variants/esp32h2/waveshare-esp32-h2/platformio.ini
Normal file
11
variants/esp32h2/waveshare-esp32-h2/platformio.ini
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[env:waveshare-esp32h2]
|
||||||
|
extends = esp32h2_base
|
||||||
|
board = esp32-h2-devkitm-1
|
||||||
|
board_build.f_flash = 16000000L
|
||||||
|
board_level = pr
|
||||||
|
build_flags =
|
||||||
|
${esp32h2_base.build_flags}
|
||||||
|
-I variants/esp32h2/waveshare-esp32-h2
|
||||||
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
|
-DARDUINO_USB_MODE=1
|
||||||
|
-DHAS_WIFI=0
|
||||||
8
variants/esp32h2/waveshare-esp32-h2/variant.h
Normal file
8
variants/esp32h2/waveshare-esp32-h2/variant.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
#define HAS_SCREEN 0
|
||||||
|
#define HAS_WIFI 0
|
||||||
|
|
||||||
|
#define LORA_SCK 4
|
||||||
|
#define LORA_MISO 3
|
||||||
|
#define LORA_MOSI 2
|
||||||
|
#define LORA_CS 1
|
||||||
Reference in New Issue
Block a user