This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF9160DK configure external flash to work with nrf9160

Hello,

I have to make the external flash on the nRF9160DK work with the nRF9160.

From what I understood, the default settings are that the external flash on the board are connected to the nRF52840 SoC.

I am trying to use the AT45 DataFlash driver sample code. It says that it is tested for the nRF9160DK. 

In the nRF9160DK documentation it says that on the board there is a 64MB flash and I assume that this flash is used for the testing.

However when I run the code I get the following error:

<err> spi_flash_at45: Wrong JEDEC ID: 00 00 00, expected: 1F 27 01
*** Booting Zephyr OS build v2.6.99-ncs1 ***
DataFlash sample on nrf9160dk_nrf9160
Device DATAFLASH_0 not found!

I found the overlay file of the program which is nrf9160dk_nrf9160.overlay and it consists the following lines for the SPI and the flash:

&spi3 {
sck-pin = <11>;
mosi-pin = <12>;
miso-pin = <13>;
cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>,
<&gpio0 10 GPIO_ACTIVE_LOW>;

at45db0: at45db041e@0 {
compatible = "atmel,at45";
reg = <0>;
spi-max-frequency = <15000000>;
label = "DATAFLASH_0";
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";
};

at45db1: at45db321e@1 {
compatible = "atmel,at45";
reg = <1>;
spi-max-frequency = <15000000>;
label = "DATAFLASH_1";
jedec-id = [1f 27 01];
size = <33554432>;
sector-size = <65536>;
block-size = <4096>;
page-size = <512>;
use-udpd;
enter-dpd-delay = <1000>;
exit-dpd-delay = <180000>;
status = "okay";
};
};

Another thing is I cannot find the flash memory on the board or in schematics of the nRF9160DK although in documentations it says it exists. 

I am starting to think that there is not flash on the board and that may be the problem.

If someone can help on what can be the problem with the following code I would be verry thankful.

Parents
  • Hello,

    The problem is I don't know what configurations I need to put to this file in order to make the needed configurations.

    This should be explained in detail in this post. You need to change the board control configurations to the nrf52840 on the DK. You can use the hello_world sample for that as explained in the post, and create an overlay as mentioned. If anything is unclear, just ask.

  • Hello,

    I saw this but when I try to build it I get the following error regarding the overlay file:

    Error: c:\Users\SvetoslavAnev\tests\nrf52\build\nrf9160dk_nrf52840.dts.pre.tmp:534.17-18 syntax error
    FATAL ERROR: Unable to parse input tree
    CMake Error at C:\Users\SvetoslavAnev\ncs\v1.7.0\zephyr\cmake\dts.cmake:219 (message):
    command failed with return code: 1
    Call Stack (most recent call first):

    this is the overlay file I write as given by the example: 

    &external_flash_pins_routing {
    status = "okay";
    };

    I've also tried with this one that I found:

    / {
    board-control {
    external_flash_pins_routing: switch-ext-mem-ctrl {
    compatible = "nordic,nrf9160dk-optional-routing";
    control-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>;
    status = "okay";
    };
    };
    };

    This one compiles and I flash it, but after that I still don't find the flash on the nrf9160.

    And also do I need to connect something physically for the connection with the 64MB memory on the board?

  • Svetlio141 said:

    This one compiles and I flash it, but after that I still don't find the flash on the nrf9160.

    Try powering the board off/on after flashing the nRF52840 with this firmware.

    Please also make sure that you specify the board revision when building

    http://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.0/nrf/ug_nrf9160.html#board-revisions

    -DBOARD=nrf9160dk_nrf9160_ns@1.0.0
    -DBOARD=nrf9160dk_nrf52840@1.0.0
     
  • Hello,

    I tried powering the board on and off but it still doesn't work.

    I specified the revision as you instructed but this doesn't work too.

    When I build my project on the nRF9160 I can only use the  9160dk_nrf9160 and not the 9160dk_nrf9160_ns. When I try to use the _ns I get this error when building:

    [78/184] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'c:\...........\ncs\v1.7.0\toolchain\opt\bin\cmake.EXE' --build 'c:\..........\tests\spi_flash_at45\build'
    The terminal process terminated with exit code: 1.

    When I build it without the _ns It builds and I can flash the device, but then I get the following error:
    [00:00:00.384,643] <err> spi_flash_at45: Wrong JEDEC ID: 00 00 00, expected: 1F 27 01
    *** Booting Zephyr OS build v2.6.99-ncs1 ***
    DataFlash sample on nrf9160dk_nrf9160
    Device DATAFLASH_0 not found!

  • I am trying to use the AT45 DataFlash driver sample code. It says that it is tested for the nRF9160DK. 

    I see now that you are trying to use the AT45 flash. This AT45 Flash is not the one that is on the nRF9160DK board. I believe an external AT45 board is needed for this spi_flash_at45 sample.

    On the nRF9160DK we use the mx25r6435f flash. 

    https://infocenter.nordicsemi.com/topic/ug_nrf91_dk/UG/nrf91_DK/external_memory.html

    https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.0-ncs1/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common_0_14_0.dtsi#L42

  • Thank you for the remark,

    I changed the specifications to search for the MX25R64.

    #define FLASH_DEVICE DT_LABEL(DT_INST(0, jedec_spi_nor))

    Still when I run the code I get:
    *** Booting Zephyr OS build v2.6.99-ncs1 ***
    DataFlash sample on nrf9160dk_nrf9160
    Device MX25R64 not found!

    Itried with the sample code for spi_flash too and get the same result that the MX25R64 is not found.

    I checked if the following overlay configuration:

    &external_flash_pins_routing {
    status = "okay";
    };

    for the nRF52 is present in the zephyr.dts file after the build, and it is.

    Also checked the zephyr.dts of the nRF9160dk and the overlay file which I included there is also present:

    &spi3 {
    status = "okay";
    sck-pin = <13>;
    mosi-pin = <11>;
    miso-pin = <12>;
    cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
    mx25r64: mx25r6435f@0 {
    compatible = "jedec,spi-nor";
    reg = <0>;
    spi-max-frequency = <8000000>;
    label = "MX25R64";
    jedec-id = [c2 28 17];
    sfdp-bfp = [
    e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
    ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
    10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
    30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
    ];
    size = <67108864>;
    has-dpd;
    t-enter-dpd = <10000>;
    t-exit-dpd = <35000>;
    };

Reply
  • Thank you for the remark,

    I changed the specifications to search for the MX25R64.

    #define FLASH_DEVICE DT_LABEL(DT_INST(0, jedec_spi_nor))

    Still when I run the code I get:
    *** Booting Zephyr OS build v2.6.99-ncs1 ***
    DataFlash sample on nrf9160dk_nrf9160
    Device MX25R64 not found!

    Itried with the sample code for spi_flash too and get the same result that the MX25R64 is not found.

    I checked if the following overlay configuration:

    &external_flash_pins_routing {
    status = "okay";
    };

    for the nRF52 is present in the zephyr.dts file after the build, and it is.

    Also checked the zephyr.dts of the nRF9160dk and the overlay file which I included there is also present:

    &spi3 {
    status = "okay";
    sck-pin = <13>;
    mosi-pin = <11>;
    miso-pin = <12>;
    cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
    mx25r64: mx25r6435f@0 {
    compatible = "jedec,spi-nor";
    reg = <0>;
    spi-max-frequency = <8000000>;
    label = "MX25R64";
    jedec-id = [c2 28 17];
    sfdp-bfp = [
    e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
    ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
    10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
    30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
    ];
    size = <67108864>;
    has-dpd;
    t-enter-dpd = <10000>;
    t-exit-dpd = <35000>;
    };

Children
Related