XIP of nRF52840

Hello,

I want to try the XIP function on the nrf52840 DK,  because we want to use this  function  later.

But i can not find any example of XIP on 52840.  So i  tried to modify the spi flash example, i try to add the ".ld" file,  and successfully saved an array into external flash, then printed part of its contents using the array name, and everything seems to be working correctly.

/* Map custom readonly section into nRF52840 QSPI XIP window. */
.extflash_rodata 0x12100000 : ALIGN(4)
{
KEEP(*(.extflash_rodata))
}

Then i tried to  store one pcm data, then read it and play it  to i2s, but the problem is when i store the array into external flash, there is no sound, and there is not any waves on the i2s-dout line, but if i store the array into internal flash, everything will be ok, sound is good.

When i stored the array into external flash, I have tried to read the data through "flash_read()" first, sound is also ok, but when i use memcpy, there is no sound. But i want to use XIP, so i can not use "flash_read()".

So i do not know what is the problem, the data stored in the external flash is unquestionably correct, as demonstrated by printing and the "flash_read" operation. However, it cannot be directly utilized when feeding data into I2S. Additionally, I have allocated an I2S buffer here and assigned the data to the buffer.

I noticed that there are "Errata 216" and "Errata 215", but i do not know the real problem of me, maybe other configurations fault(devicetree or kconfig), after all i can not find some example.

So, i will give you my project, i used SDK v3.3.0, nrf52840-Preview-DK.

4578.spi_flash.zip

Can you  have a look of my project? now i have add the "__attribute__((section(".extflash_rodata"), used))" to the "__48kHz16bit_mono_voice_smoke_pcm", so there is no sound...

Thank you very much!

Related