fix_soc_sdmmc_and_add_soc_temperature_for_s3_support

This commit is contained in:
michael
2025-01-02 16:39:26 +01:00
parent c6a593ba0d
commit b72d809e59
3 changed files with 104 additions and 14 deletions

View File

@@ -79,10 +79,10 @@
static heap_trace_record_t trace_record[NUM_RECORDS]; // This buffer must be in internal RAM
#endif
extern const char* GIT_TAG;
extern const char* GIT_REV;
extern const char* GIT_BRANCH;
extern const char* BUILD_TIME;
extern const char *GIT_TAG;
extern const char *GIT_REV;
extern const char *GIT_BRANCH;
extern const char *BUILD_TIME;
extern std::string getFwVersion(void);
extern std::string getHTMLversion(void);
@@ -109,27 +109,51 @@ bool Init_NVS_SDCard()
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
// For SoCs where the SD power can be supplied both via an internal or external (e.g. on-board LDO) power supply.
// When using specific IO pins (which can be used for ultra high-speed SDMMC) to connect to the SD card
// and the internal LDO power supply, we need to initialize the power supply first.
#if SD_PWR_CTRL_LDO_INTERNAL_IO
sd_pwr_ctrl_ldo_config_t ldo_config = {
.ldo_chan_id = CONFIG_EXAMPLE_SD_PWR_CTRL_LDO_IO_ID,
};
sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL;
ret = sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &pwr_ctrl_handle);
if (ret != ESP_OK)
{
ESP_LOGE(TAG, "Failed to create a new on-chip LDO power control driver");
return ret;
}
host.pwr_ctrl_handle = pwr_ctrl_handle;
#endif
// This initializes the slot without card detect (CD) and write protect (WP) signals.
// Modify slot_config.gpio_cd and slot_config.gpio_wp if your board has these signals.
#ifdef CONFIG_SOC_SDMMC_USE_GPIO_MATRIX
sdmmc_slot_config_t slot_config = {
.cd = SDMMC_SLOT_NO_CD,
.wp = SDMMC_SLOT_NO_WP,
};
#else
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
#endif
// Set bus width to use:
#ifdef __SD_USE_ONE_LINE_MODE__
slot_config.width = 1;
#ifdef SOC_SDMMC_USE_GPIO_MATRIX
#ifdef CONFIG_SOC_SDMMC_USE_GPIO_MATRIX
slot_config.clk = GPIO_SDCARD_CLK;
slot_config.cmd = GPIO_SDCARD_CMD;
slot_config.d0 = GPIO_SDCARD_D0;
#endif
#else
#endif // end CONFIG_SOC_SDMMC_USE_GPIO_MATRIX
#else // else __SD_USE_ONE_LINE_MODE__
slot_config.width = 4;
#ifdef SOC_SDMMC_USE_GPIO_MATRIX
#ifdef CONFIG_SOC_SDMMC_USE_GPIO_MATRIX
slot_config.d1 = GPIO_SDCARD_D1;
slot_config.d2 = GPIO_SDCARD_D2;
slot_config.d3 = GPIO_SDCARD_D3;
#endif
#endif
#endif // end CONFIG_SOC_SDMMC_USE_GPIO_MATRIX
#endif // end __SD_USE_ONE_LINE_MODE__
// Enable internal pullups on enabled pins. The internal pullups
// are insufficient however, please make sure 10k external pullups are
@@ -350,6 +374,12 @@ extern "C" void app_main(void)
// ********************************************
setupTime(); // NTP time service: Status of time synchronization will be checked after every round (server_tflite.cpp)
// Init SOC temperature sensor (if supported by hardware)
// ********************************************
#if defined(CONFIG_SOC_TEMP_SENSOR_SUPPORTED)
initTemperatureSensor();
#endif
// Set CPU Frequency
// ********************************************
setCpuFrequency();