Configuring external flash memory on the nRF9160 DK

The nRF9160 DK version 0.14.0 and later versions contain an 8-MB external flash (MX25R6435F). The external flash can be used to store data that does not fit on the internal flash. To free up GPIO when the external flash is not needed, the nRF9160 DK board controller (nRF52840 SoC) controls a switch to enable or disable routing between the external flash and the nRF9160 SIP.

See the nRF9160 DK board controller and External memory sections in the nRF9160 DK user guides for more details.

Programming the board controller firmware

To use the external flash memory on the nRF9160 DK v0.14.0 or later versions, the board controller firmware must be of version v2.0.1. This is the factory firmware version. If you need to program the board controller firmware again, complete the following steps:

  1. Download the nRF9160 DK board controller firmware from the nRF9160 DK downloads page.

  2. Make sure the PROG/DEBUG SW10 switch on the nRF9160 DK is set to nRF52.

  3. Program the board controller firmware (nrf9160_dk_board_controller_fw_2.0.1.hex) using the Programmer app in nRF Connect for Desktop. By default, this enables pin routing to external flash.

Adding the configuration and devicetree option

To use external flash, you also need to enable configuration and devicetree options by completing the following steps:

  1. Enable the following Kconfig options by setting each to y in your project configuration:

  2. Specify the board revision parameter when Building an application to automatically include the devicetree overlay with the external flash. The board revision is printed on the label of your DK, just below the PCA number.

  3. Then add the following relevant devicetree blocks to the application`s devicetree overlay file, depending on your application`s needs:

    &mx25r64 {
         /* Enable the external flash device (required) */
         status = "okay";
    
         /* Enable high performance mode to increase write/erase performance */
         mxicy,mx25r-power-mode = "high-performance";
    
         /* Add partitions as required */
         partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;
    
            fmfu_storage_partition: partition@0 {
                 label = "fmfu_storage";
                 reg = <0x00000000 0x400000>;
            };
    
            modem_trace: partition@400000 {
                 label = "modem_trace";
                 reg = <0x00400000 0x400000>;
            };
    
            pgps_partition: partition@800000 {
                 label = "pgps";
                 reg = <0x00800000 0x14000>;
            };
    
            settings_storage_partition: partition@814000 {
                 label = "settings_storage";
                 reg = <0x00814000 0x2000>;
            };
    
            external_flash_partition: partition@816000 {
                 label = "external_flash";
                 reg = <0x00816000 0x17ea000>;
            };
         };
    };
    

    For more information about devicetree overlays, see Use devicetree overlays.