SPI Flash - Parition Manager - QSPI config causing build errors

Hello! My starting point for this issue is a custom board using an nrf52832 and a SPI flash chip (MX25R1635F).

So far I have been able to initialize the SPI flash (the JEDEC ID is read and verified successfully), but I want to use it with the FCB system (currently working fine on internal flash).

I followed the instructions here  (or at least I tried to) to set up a partition in external flash that I can then reference when initializing the FCB. When I build, I'm getting hundreds of lines of errors, most along these lines:

error: unknown type name 'NRF_QSPI_Type'; did you mean 'NRF_SPI_Type'?
  967 | NRF_STATIC_INLINE void nrf_qspi_cinstr_long_transfer_start(NRF_QSPI_Type *                p_reg,
      |                                                            ^~~~~~~~~~~~~
      |                                                            NRF_SPI_Type

Along with

zephyr/drivers/flash/nrf_qspi_nor.c:69:2: error: #error "No size specified. 'size' or 'size-in-bytes' must be set"
   69 | #error "No size specified. 'size' or 'size-in-bytes' must be set"

This led me to try setting `CONFIG_NORDIC_QSPI_NOR=n` explicitly in my proj.conf, but it's still showing the same errors (even with PM_OVERRIDE_EXTERNAL_DRIVER_CHECK). When I look in the .config file in the build folder (snippet below), it's getting set back to `y`, but I can't find any clue as to why.

#
# Nordic nRF Connect
#
CONFIG_BOOT_BANNER_STRING="Booting nRF Connect SDK"
CONFIG_MBEDTLS_LIBRARY_NRF_SECURITY=y
CONFIG_WARN_EXPERIMENTAL=y
CONFIG_PRIVILEGED_STACK_SIZE=1024
CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=2475
CONFIG_BT_BUF_CMD_TX_COUNT=2
CONFIG_ENTROPY_GENERATOR=y
CONFIG_INIT_ARCH_HW_AT_BOOT=y
CONFIG_NORDIC_QSPI_NOR=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
# CONFIG_GETOPT is not set
# CONFIG_NCS_SAMPLES_DEFAULTS is not set

Here are the rest of the relevant config snippets:

The flash device is configured in my overlay as below

/ {
	chosen {
		nordic,pm-ext-flash = &mx25r1635;
	};
	zephyr,user {
		io-channels = <&adc 0>, <&adc 1>;
		tc-bias-gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
	};

	aliases {
		mx25r16 = &mx25r1635;
	};
};


/* other configs */

&spi0 {
	status = "okay";
	compatible = "nordic,nrf-spi";
	clock-frequency = <8000000>;
	pinctrl-0 = <&spi0_default>;
	pinctrl-1 = <&spi0_sleep>;
	pinctrl-names = "default", "sleep";
	cs-gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;

	mx25r1635: mx25r1635@0 {
		compatible = "jedec,spi-nor";
		/* 16777216 bits = 2 Mbytes */
		size = <0x1000000>;
		reg = <0>;
		spi-max-frequency = <33000000>;
		jedec-id = [c2 28 15];
		status = "okay";
		wp-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
		hold-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
		has-dpd;
		dpd-wakeup-sequence = <30000 20 45000>;
		t-enter-dpd = <10000>;
		mxicy,mx25r-power-mode = "high-performance";
	};
};

I have the following pm_static.yml

nvs_storage:
  address: 0x7B000
  end_address: 0x7D000
  region: flash_primary
  size: 0x2000
internal_fcb:
  address: 0x7D000
  end_address: 0x80000
  region: flash_primary
  size: 0x3000
external_fcb:
  address: 0x000000
  device: MX25R16
  end_address: 0x1000000
  region: external_flash
  size: 0x1000000

The following is a snippet from my prj.conf

# Internal Flash/NVS
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_FLASH=y
CONFIG_IMG_MANAGER=y
CONFIG_STREAM_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_NVS=y
CONFIG_MPU=y
CONFIG_SOC_FLASH_NRF_UICR=y
CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y

# SPI Flash
CONFIG_SPI=y
# CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58=y
CONFIG_SPI_NOR=y
CONFIG_NORDIC_QSPI_NOR=n
CONFIG_PPI_TRACE=y
CONFIG_FCB=y
CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

A handful of items in there were gleaned from various support tickets, but many of them may have been out of date. Anyway, I appreciate any guidance you can provide.

Thank you!

Parents
  • Hello,

    It's odd that the QSPI driver is being enabled when you are building with PM_OVERRIDE_EXTERNAL_DRIVER_CHECK. Are you building with MCUBoot by any chance? In that case, please make sure you are applying the same Kconfig and DT overlay to the bootloader build. You can create a child_image folder to apply these overlays to MCUBoot (Permanent configuration changes to child images).

    e.g.,

    ├── child_image
    │   ├── mcuboot.conf
    │   └── mcuboot.overlay

    If possible, could you please share a minimal version of your project here or through a private ticket so I can attempt to build it on my end? 

    Best regards,

    Vidar

Reply
  • Hello,

    It's odd that the QSPI driver is being enabled when you are building with PM_OVERRIDE_EXTERNAL_DRIVER_CHECK. Are you building with MCUBoot by any chance? In that case, please make sure you are applying the same Kconfig and DT overlay to the bootloader build. You can create a child_image folder to apply these overlays to MCUBoot (Permanent configuration changes to child images).

    e.g.,

    ├── child_image
    │   ├── mcuboot.conf
    │   └── mcuboot.overlay

    If possible, could you please share a minimal version of your project here or through a private ticket so I can attempt to build it on my end? 

    Best regards,

    Vidar

Children
Related