Zephyr flash_erase(w25q32jv@0, 524288, 4096) faild -19

I use Zephyr flash_erase() to erase Winbond W25Q32JV NOR flash. But I flash_erase() return error code -19. What is meaning of error code -19? And how to fix this issue?

The following is code to call flash_erase().

int flashNorEraseData(const off_t offset, const size_t len) {
    if (!flashNorGetInitialzed()) {
        return ERROR_NOR_UNINITIALIZED;
    }

    const int ret = flash_erase(_gFlashDev, offset, len);
    if (ret < 0) {
        printk("flash_erase(%s, %ld, %u) faild %d\n", _gFlashDev->name, offset, len, ret);
        return ERROR_FSTORAGE_ERASE_FAIL;
    }

    return 0;
}

The following are log messages.

*** Booting Zephyr OS build v3.2.99-ncs2 *
jedec-id = [ef 40 16]
_gDensity=4194304
flash_erase(w25q32jv@0, 524288, 4096) faild -19
Erasing from 524288 to 528383 failed

Parents
  • Hiow about the devicetree file setting in your code?

    I think that the issue is happened in the overlay file for the jedec-id

    or other device tree matrix 

    For example

    &spi3 {
    pinctrl-0 = <&spi3_default_alt>;
    pinctrl-1 = <&spi3_sleep_alt>;
    pinctrl-names = "default", "sleep";
    cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>,
    <&gpio0 10 GPIO_ACTIVE_LOW>;

    at45db0: at45db041e@0 {
    compatible = "atmel,at45";
    reg = <0>;
    spi-max-frequency = <15000000>;
    jedec-id = [1f 24 00];
    size = <4194304>;
    sector-size = <65536>;
    block-size = <2048>;
    page-size = <256>;
    enter-dpd-delay = <2000>;
    exit-dpd-delay = <35000>;
    status = "disabled";
    };

    }

    You have to check the flash specification is math the overlay file or not.

Reply
  • Hiow about the devicetree file setting in your code?

    I think that the issue is happened in the overlay file for the jedec-id

    or other device tree matrix 

    For example

    &spi3 {
    pinctrl-0 = <&spi3_default_alt>;
    pinctrl-1 = <&spi3_sleep_alt>;
    pinctrl-names = "default", "sleep";
    cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>,
    <&gpio0 10 GPIO_ACTIVE_LOW>;

    at45db0: at45db041e@0 {
    compatible = "atmel,at45";
    reg = <0>;
    spi-max-frequency = <15000000>;
    jedec-id = [1f 24 00];
    size = <4194304>;
    sector-size = <65536>;
    block-size = <2048>;
    page-size = <256>;
    enter-dpd-delay = <2000>;
    exit-dpd-delay = <35000>;
    status = "disabled";
    };

    }

    You have to check the flash specification is math the overlay file or not.

Children
Related