We can successfully init this chip with the following code:
Code: Select all
// Init External Flash
ESP_LOGI(Tag, "Init External Flash");
const esp_flash_spi_device_config_t config = {
.host_id = SPI2_HOST,
.cs_io_num = GPIO_NUM_10,
.io_mode = SPI_FLASH_DIO,
.speed = ESP_FLASH_5MHZ, // Deprecrated
.input_delay_ns = 0,
.cs_id = 0,
.freq_mhz = ESP_FLASH_5MHZ ///< The frequency of flash chip(MHZ)
};
esp_flash_t* chip = nullptr;
const esp_partition_t* partition = nullptr;
spi_bus_add_flash_device(&chip, &config);
esp_flash_init(chip);
err = esp_partition_register_external(chip, 0, chip->size, "ext_lfs", ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_UNDEFINED, &partition);
Is this intended behaviour?
I've got a workarround and that is by forcefully setting the variable after the register_external command.
Code: Select all
((esp_partition_t*)(partition))->erase_size = 4096;
is there a better way to solve this?