Is there any way to memory-map external flash other than XIP?

I know that I can memory-map external flash using XIP in the NRF52 and NRF53. However, with XIP, you can't write to the memory-mapped addresses (makes sense since you don't usually overwrite instructions during execution). However, is it possible to memory-map an external flash chip so I can read and write to it using the NRF52 address space just like I can with XIP?

I'm attempting to interface the NRF53 with another (custom) IC over QSPI and it would be nice to do it with memory-mapped IO. If XIP is the only way forward, I suppose I can read the register space of the external IC using XIP and write to it using custom instructions--I was just hoping there was a more elegant way.

Parents
  • Hi

    Yes, I think this should be possible, although I'm not sure the unmodified QSPI driver does this for you, you can implement custom instructions to allow it to write. If you check out how QSPI driver instance config implements the xip_offset to set an address in the external memory where the XIP section starts. You should be able to do something similar for any part of the mapping and let it read/write from that part of the flash specifically.

    Best regards,

    Simon

  • Couldn't you just create a separate partition in the QSPI flash devoted to the memory-mapped I/O.  The partition would be defined in pm_static.yml in your project.  Then you could use flash_area_open(), flash_area_read(), and flash_area_write() to access areas in the partition.

  • If I use `flash_area_read()`, wouldn't I have to do that every time I want to access the external IC? With XIP, all I have to do is configure my linker file to place all my external IC register definitions at 0x12000000, and then I can read them directly from the code running on the Nordic and it'll automatically fetch them over QSPI. I wouldn't have to call functions each time I want to read a register on my external IC.

Reply
  • If I use `flash_area_read()`, wouldn't I have to do that every time I want to access the external IC? With XIP, all I have to do is configure my linker file to place all my external IC register definitions at 0x12000000, and then I can read them directly from the code running on the Nordic and it'll automatically fetch them over QSPI. I wouldn't have to call functions each time I want to read a register on my external IC.

Children
Related