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.

  • 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>;
    };

  • Did you set 

    CONFIG_SPI_NOR=y

    in prj.conf as well?

    If it does not work, can you upload the spi_flash sample with the changes you did ?

  • Did you set 

    CONFIG_SPI_NOR=y

    I hadn't set this. Now that I did, I established communication with the flash and everything is working.

    Thank you for the help!

Related