Access External Flash as Raw/low-level device. No file system wanted

I wanted to add this info to my previous ticket, but there was no option to reply. Just an FYI, here is the link:

https://devzone.nordicsemi.com/f/nordic-q-a/84225/expert-advice-on-best-flash-interface-for-the-nrf9160dk-and-clarification-of-the-devicetree

So after doing some more research I found a link (from Hakon) where he had attached a littlefs.zip that shows how to configure the 64MB flash device as a file system. That was very beneficial, but I really don't want the file system. I'd prefer to access the flash using low-level calls like:

flash_area_open(FLASH_AREA_ID(storage), &my_area

-or-

flash_dev = device_get_binding(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL)

flash_read(flash_dev, ...,...);

Is there a way I can modify the overlay to provide that type of access for the external flash? Here is the overlay I'm using:

/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};

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

Parents
  • Hello Dejans, following your advice, I just created a Hello_World example using SES. I compiled and ran it successfully. Afterwards I ran Clean Solution.Then I just dropped the files from the littlefs.zip archive from Nordic into the project folder. Ran CMake and did a solution build. But I got the same crash. I'm attaching a zip with the project and logs into this ticket. In the root folder you will find the CMake log, the build log, and a screenshot of the crash info. Thanks in advance for your continued help!

     solution_and_logs.zip

  • Hi Kevin,

    Did you use a completely new project for littlefs (unrelated to hello_world)?
    Which operating system are you using and how did you run cmake?
    Could you try using nRF Connect for Desktop v1.8.0? Is there any difference from v1.7.1 that you used?

    Best regards,
    Dejan

  • Yes, I started with a fresh version of blinky for the nRF9160DK (ns).

    I have a Windows 10 environment running on a brand new HP, Intel-based laptop

    I haven't tried v1.8.0. yet. My deadlines don't really provide much time for experimentation unfortunately.

    BTW, I am using SES for my IDE in case it matters.

  • Hi Kevin,

    I would not recommend you to start with blinky example. It would be better if you start from the clean littlefs example and then start adding what you need on top of that.

    Best regards,
    Dejan

Reply
  • Hi Kevin,

    I would not recommend you to start with blinky example. It would be better if you start from the clean littlefs example and then start adding what you need on top of that.

    Best regards,
    Dejan

Children
No Data