how to access data directly from external nor flash mx25r6435f on nRF5340 DK

Hi community,

I'm using the following setup:

  1. nRF5340DK
  2. nRF Connect SDK v2.6.0
  3. B0, upgradable secure MCUBoot, and application
  4. Statically defined partitions in the partition manager

a large amount of data (>200KB) is saved in the external NOR flash mx25r6435f via BLE, the data is always at the same offset in the flash.

Currently, I'm using flash_area_read(fa, 0, hex_data, 100) to retrieve the data, but it's not so efficient. I saw that XIP (Execute In Place) can be used for read-only purposes, but I can't find any samples or guidance on how to implement it.

what I really want is a way to hold a pointer to the data that is stored in the external flash, so that I can access any single hex data with address operation,

then I found this article about memory mapped pointer:ESP32 Flash Memory-Mapped

but it's all about ESP board, so my question is: how can I achive this memory mapped pointer operation for the external flash mx25r6435f with nRF5340. 

Could you provide any examples or hints on how to use XIP or memory mapped pointer to access any single data on external flash via its address?

Thank you for your support.

Best regards,
Danny

Parents
  • I tried this:

            printk("QSPI base: 0x%08lx\n", (uint32_t)DT_REG_ADDR(DT_NODELABEL(qspi)));
            printk("FA offset: 0x%08lx\n", (uint32_t)fa->fa_off);
            const uint8_t *ptr = (const uint8_t *)(fa->fa_off + DT_REG_ADDR(DT_NODELABEL(qspi)));
            for (uint8_t i = 0; i < 100; i++) {
                printk("%02x ", ptr[i]);
                k_msleep(5);
            }
    and get this:
    QSPI base: 0x5002b000
    FA offset: 0x00120000
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

    there shall be some valid values, but I get only 00.
Reply
  • I tried this:

            printk("QSPI base: 0x%08lx\n", (uint32_t)DT_REG_ADDR(DT_NODELABEL(qspi)));
            printk("FA offset: 0x%08lx\n", (uint32_t)fa->fa_off);
            const uint8_t *ptr = (const uint8_t *)(fa->fa_off + DT_REG_ADDR(DT_NODELABEL(qspi)));
            for (uint8_t i = 0; i < 100; i++) {
                printk("%02x ", ptr[i]);
                k_msleep(5);
            }
    and get this:
    QSPI base: 0x5002b000
    FA offset: 0x00120000
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

    there shall be some valid values, but I get only 00.
Children
No Data
Related