Nrf52840 use SPI Flash by SPIFBlockDevice fail -4002

Kobe_Wang
Mon, 08 Aug 2022 07:29:25 +0000
Mbed OS

Hi All

I’m coding on EByte_E73 module of nrf52840 core with mbed os, It’s work fine with MX25L12833FM2I external spi flash by SPIFBlockDevice class.

But I want to use this flash as secondary_bd for DFU function by mcuboot 。

I can make sure the bootloader is work, because it can load the first version with mcuboot bootloader. All other function is OK. But when I test DFU , I need use the external flash as secondary_bd to save update firmware. but SPIFBlockDevice can’t work fine now, the init function return -4002.

I searched on the Internet, and there was no useful information to help me. So I narrowed down my investigation. @Official Can you tell why the external flash init fail ? Anyone meet same situation ? thanks

This is my custom_targets.json:

{
    "EBYTE_E73": {
        "inherits": [
            "MCU_NRF52840"
        ],
        "detect_code": [
            "1102"
        ],
        "components_add": ["SPIF", "FLASHIAP", "SD"],
        "features_remove": ["CRYPTOCELL310"],
        "macros_remove": ["MBEDTLS_CONFIG_HW_SUPPORT"],
        "config": {
            "enable-objects-extensions": {
                "help": "Enable inclusion of objects_extensions.h",
                "value": false
            },
            "lf_clock_xtal_accuracy": {
                "value": "NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM",
                "macro_name": "MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY"
            }
        },
        "overrides": {
            "lf_clock_src": "NRF_LF_SRC_RC",
            "lf_clock_rc_calib_timer_interval": 16,
            "lf_clock_rc_calib_mode_config": 0
        },
        "supported_application_profiles": [
            "full", "bare-metal"
        ]
    }
}

This is my mbed_app.json:

{
    "target_overrides": {
        "*": {
            "target.bootloader_img": null,
            "target.printf_lib": "std",
            "target.components_add": ["SD"]
        },
        "EBYTE_E73": {
            "target.mbed_app_start": "0x21000",
            "target.mbed_app_size": "0xBE000"
        }
    }
}

7 posts - 2 participants