Failed to get chip size NINA101

Gardin
Posts: 31
Joined: Fri Dec 13, 2019 4:53 pm

Failed to get chip size NINA101

Postby Gardin » Sun Dec 13, 2020 12:20 am

Hello everyone,

I'm working with a custom PCB based on the u-blox NINA 101.

This module uses a 2MB flash, and my PCB also comes with an extra 16MB flash(W25Q128).

The problem is that in order to the NINA module to work I need to set CONFIG_SPI_FLASH_USE_LEGACY_IMPL, otherwhise the system fails to read the chip size and the esp crashes. If I set CONFIG_SPI_FLASH_USE_LEGACY_IMPL to true I lost some useful API that I would like to use for the extra 16MB flash.

How can I bypass this error? I saw similar issues on github but I was not able to correct the issue.

Thank's a lot,
Gabriel Gardin

Gardin
Posts: 31
Joined: Fri Dec 13, 2019 4:53 pm

Re: Failed to get chip size NINA101

Postby Gardin » Sun Dec 13, 2020 1:33 am

So, I still have the error but I was able to make make it works by altering the file esp_flash_spi_init.c

I just ignore the error:

Code: Select all

esp_err_t esp_flash_init_default_chip(void)
{
    memspi_host_config_t cfg = ESP_FLASH_HOST_CONFIG_DEFAULT();
    //the host is already initialized, only do init for the data and load it to the host
    spi_flash_hal_init(&default_driver_data, &cfg);
    default_chip.host->driver_data = &default_driver_data;

    // ROM TODO: account for non-standard default pins in efuse
    // ROM TODO: to account for chips which are slow to power on, maybe keep probing in a loop here
    esp_err_t err = esp_flash_init(&default_chip);
    if (err != ESP_OK) {
        //return err;
        default_chip.size = g_rom_flashchip.chip_size; //Here is the "workaround"
    }
    if (default_chip.size < g_rom_flashchip.chip_size) {
        ESP_EARLY_LOGE(TAG, "Detected size(%dk) smaller than the size in the binary image header(%dk). Probe failed.", default_chip.size/1024, g_rom_flashchip.chip_size/1024);
        return ESP_ERR_FLASH_SIZE_NOT_MATCH;
    } else if (default_chip.size > g_rom_flashchip.chip_size) {
        ESP_EARLY_LOGW(TAG, "Detected size(%dk) larger than the size in the binary image header(%dk). Using the size in the binary image header.", default_chip.size/1024, g_rom_flashchip.chip_size/1024);
        default_chip.size = g_rom_flashchip.chip_size;
    }
    default_chip.size = g_rom_flashchip.chip_size;

    esp_flash_default_chip = &default_chip;
    return ESP_OK;
}
Although it's working this is going to ignore any other errors that might happened, so it's not a truly solution.

Who is online

Users browsing this forum: No registered users and 86 guests