Matter Application throws FIH_PANIC within flash_area_open()

Hello,

I am developing a Door Lock Matter application using the nRF5340 + AT25XE321D (32Mb SPI-NOR External flash). I am having problems with getting my Matter application to boot using my current configuration. The application throws an FIH_PANIC in this piece of code in bootloader/mcuboot/boot/bootutil/src/loader.c on boot.

I am using nRF Connect SDK v2.6.1.

/* Open primary and secondary image areas for the duration
* of this call.
*/
for (slot = 0; slot < BOOT_NUM_SLOTS; slot++) {
    fa_id = flash_area_id_from_multi_image_slot(image_index, slot);
    rc = flash_area_open(fa_id, &BOOT_IMG_AREA(state, slot));
    assert(rc == 0);

    if (rc != 0) {
        BOOT_LOG_ERR("Failed to open flash area ID %d (image %d slot %d): %d, "
                         "cannot continue", fa_id, image_index, (int8_t)slot, rc);
        FIH_PANIC;
    }
}

This is my devicetree definition for the SPI-NOR Flash Device tree:

arduino_spi: &spi4 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
	pinctrl-0 = <&spi4_default>;
	pinctrl-1 = <&spi4_sleep>;
	pinctrl-names = "default", "sleep";
	at25xe321d: at25xe321d@0 {
		status = "okay";
		compatible = "jedec,spi-nor";
		reg = < 0 >;
		spi-max-frequency = < 100000000 >;
		hold-gpios = < &gpio0 6 GPIO_ACTIVE_LOW >;
		size = < 0x400000 >;
		has-dpd;
		t-enter-dpd = < 3000 >;
		t-exit-dpd = < 1200000 >;
		jedec-id = [ 1f 47 0c ];
	};
};

This is my pm_static_dfu.yml file:

mcuboot:
  address: 0x0
  size: 0x10000
  region: flash_primary
mcuboot_pad:
  address: 0x10000
  size: 0x200
app:
  address: 0x10200
  size: 0xe6e00
mcuboot_primary:
  orig_span: &id001
  - mcuboot_pad
  - app
  span: *id001
  address: 0x8000
  size: 0xef000
  region: flash_primary
mcuboot_primary_app:
  orig_span: &id002
  - app
  span: *id002
  address: 0x10200
  size: 0xe6e00
factory_data:
  address: 0xf7000
  size: 0x1000
  region: flash_primary
settings_storage:
  address: 0xf8000
  size: 0x8000
  region: flash_primary
mcuboot_primary_1:
  address: 0x0
  size: 0x40000
  device: flash_ctrl
  region: ram_flash
mcuboot_secondary:
  address: 0x0
  size: 0xef000
  device: DT_CHOSEN(nordic_pm_ext_flash)
  region: external_flash
mcuboot_secondary_1:
  address: 0xef000
  size: 0x40000
  device: DT_CHOSEN(nordic_pm_ext_flash)
  region: external_flash
external_flash:
  address: 0x12F000
  size: 0x2D1000
  device: DT_CHOSEN(nordic_pm_ext_flash)
  region: external_flash
pcd_sram:
  address: 0x20000000
  size: 0x2000
  region: sram_primary

Attached is also: (Filenames are only changed for devzone)

  1. prj.conf, which is in my child_image/mcuboot/prj.conf
  2. nrf5340dk_nrf5340_cpuapp.overlay which is located in child_image/mcuboot/nrf5340dk_nrf5340_cpuapp/nrf5340dk_nrf5340_cpuapp.overlay.
  3. Attached is also my boards/nrf5340dk_nrf5340_cpuapp.overlay which I am building my application with!
  4. the main prj.conf located in the project root

When debugging, the slot variable is 1. So I expect that mcuboot_secondary is failing.

I would sincerely appreciate any and all help!

0755.mcuboot_prj.conf

2821.mcuboot_nrf5340dk_nrf5340_cpuapp.overlay

4087.nrf5340dk_nrf5340_cpuapp.overlay

6153.prj.conf

Parents
  • Hi, 

    Please remove the static partition while developing. 

    You can use the JEDEC SPI-NOR sample to test whether the SPI external flash settings are correct or not. Could you help confirm this part?

    Regards,
    Amanda H.

  • Hey Amanda!

    SPI-Flash sample works correctly! I set the nrf5340dk_nrf5340_cpuapp.overlay within the boards folder and changed the nrf5340dk_nrf5340_cpuapp.conf file to enable CONFIG_SPI_NOR=y. This made the sample work correctly.

    I also built the project without a static.yml file and it FIH_PANIC at the same spot in loader.c.

    On further debugging, within this function, I get rc = -ENODEV(-19) after returning from flash_area_open();

    for (slot = 0; slot < BOOT_NUM_SLOTS; slot++) {
                fa_id = flash_area_id_from_multi_image_slot(image_index, slot);
                rc = flash_area_open(fa_id, &BOOT_IMG_AREA(state, slot));
                assert(rc == 0);
    
                if (rc != 0) {
                    BOOT_LOG_ERR("Failed to open flash area ID %d (image %d slot %d): %d, "
                                 "cannot continue", fa_id, image_index, (int8_t)slot, rc);        
                                 
                    FIH_PANIC;
                }
            }

  • Could you provide the complete boot log?

    Is it able to boot up when it got FIH_PANIC?

  • I can provide the bootlog from the debugger when using VSCode. Let me know if there are any other logs I can provide!

    JLinkGDBServerCLExe: SEGGER J-Link GDB Server V7.94e Command Line Version
    JLinkGDBServerCLExe: 
    JLinkGDBServerCLExe: JLinkARM.dll V7.94e (DLL compiled Jan 15 2024 15:19:33)
    JLinkGDBServerCLExe: 
    JLinkGDBServerCLExe: -----GDB Server start settings-----
    JLinkGDBServerCLExe: GDBInit file:                  none
    JLinkGDBServerCLExe: GDB Server Listening port:     36211
    JLinkGDBServerCLExe: SWO raw output listening port: 2332
    JLinkGDBServerCLExe: Terminal I/O port:             2333
    JLinkGDBServerCLExe: Accept remote connection:      yes
    JLinkGDBServerCLExe: Generate logfile:              off
    JLinkGDBServerCLExe: Verify download:               off
    JLinkGDBServerCLExe: Init regs on start:            off
    JLinkGDBServerCLExe: Silent mode:                   on
    JLinkGDBServerCLExe: Single run mode:               on
    JLinkGDBServerCLExe: Target connection timeout:     0 ms
    JLinkGDBServerCLExe: ------J-Link related settings------
    JLinkGDBServerCLExe: J-Link Host interface:         USB
    JLinkGDBServerCLExe: J-Link script:                 none
    JLinkGDBServerCLExe: J-Link settings file:          none
    JLinkGDBServerCLExe: ------Target related settings------
    JLinkGDBServerCLExe: Target device:                 nrf5340_xxaa_app
    JLinkGDBServerCLExe: Target device parameters:      none
    JLinkGDBServerCLExe: Target interface:              SWD
    JLinkGDBServerCLExe: Target interface speed:        12000kHz
    JLinkGDBServerCLExe: Target endian:                 little
    JLinkGDBServerCLExe: 
    =thread-group-added,id="i1"
    =cmd-param-changed,param="pagination",value="off"
    context_boot_go (state=state@entry=0x20004654 <boot_data>, rsp=rsp@entry=0x20049ab4 <z_main_stack+133620>) at /home/jai/ncs/v2.6.1/bootloader/mcuboot/boot/bootutil/src/loader.c:2325
    2325	                FIH_PANIC;
    [New Remote target]
    [New Thread 1989888]
    [New Thread 4294967295]
    

    I also tried to add breakpoints into the application and it returns the same panic error:

    Thread 4 hit Breakpoint 2, context_boot_go (state=state@entry=0x20004654 <boot_data>, rsp=rsp@entry=0x20049ab4 <z_main_stack+133620>) at /home/jai/ncs/v2.6.1/bootloader/mcuboot/boot/bootutil/src/loader.c:2317
    2317	            fa_id = flash_area_id_from_multi_image_slot(image_index, slot);
    Execute debugger commands using "-exec <command>" or "`<command>", for example "-exec info registers" or "`info registers" will list registers in use (when GDB is the debugger)
    
    Thread 4 received signal SIGTRAP, Trace/breakpoint trap.
    context_boot_go (state=state@entry=0x20004654 <boot_data>, rsp=rsp@entry=0x20049ab4 <z_main_stack+133620>) at /home/jai/ncs/v2.6.1/bootloader/mcuboot/boot/bootutil/src/loader.c:2325
    2325	                FIH_PANIC;
    
    Thread 4 received signal SIGTRAP, Trace/breakpoint trap.
    context_boot_go (state=state@entry=0x20004654 <boot_data>, rsp=rsp@entry=0x20049ab4 <z_main_stack+133620>) at /home/jai/ncs/v2.6.1/bootloader/mcuboot/boot/bootutil/src/loader.c:2325
    2325	                FIH_PANIC;
    
    Thread 4 received signal SIGTRAP, Trace/breakpoint trap.
    context_boot_go (state=state@entry=0x20004654 <boot_data>, rsp=rsp@entry=0x20049ab4 <z_main_stack+133620>) at /home/jai/ncs/v2.6.1/bootloader/mcuboot/boot/bootutil/src/loader.c:2325
    2325	                FIH_PANIC;
    
    Thread 4 received signal SIGTRAP, Trace/breakpoint trap.
    context_boot_go (state=state@entry=0x20004654 <boot_data>, rsp=rsp@entry=0x20049ab4 <z_main_stack+133620>) at /home/jai/ncs/v2.6.1/bootloader/mcuboot/boot/bootutil/src/loader.c:2325
    2325	                FIH_PANIC;

  • No, not that.  I want the NCS log without debugging. 

    Without debug mode, Is it able to boot up? 

  • Thank you for getting back! I get no logs and the debugger doesnt attach. I have attached the output from my terminal!

    My prj.conf has this debug configuration:

    CONFIG_LOG=y
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=n
    CONFIG_RTT_CONSOLE=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_LOG_MODE_MINIMAL=n

  • Hi, 

    I find the Door Lock Matter is a big application, it would overflow if enabling the log of the mcuboot. Therefore, I would suggest using a smaller application like smp_svr to test the DFU with your external flash. Here is my test project 0675.smp_svr_nRF5340DK_spi.7z to use SPI external flash on nRF5340DK for your reference.

    Beware that this code/configuration is not fully tested or qualified and should be considered provided “as-is”. Please test it with your application and let me know if you find any issues.

    -Amanda H.

Reply
  • Hi, 

    I find the Door Lock Matter is a big application, it would overflow if enabling the log of the mcuboot. Therefore, I would suggest using a smaller application like smp_svr to test the DFU with your external flash. Here is my test project 0675.smp_svr_nRF5340DK_spi.7z to use SPI external flash on nRF5340DK for your reference.

    Beware that this code/configuration is not fully tested or qualified and should be considered provided “as-is”. Please test it with your application and let me know if you find any issues.

    -Amanda H.

Children
No Data
Related