This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

fds garbage collection interferes with i2s communication

Hello Nordic Team,

I have an application where i am playing some samples over i2s to an audio amplifier. The application also uses fds to store those samples (they can be updated over ble) and some other settings. So it has a pretty big fds storage (120 pages of 1024 word).

I now noticed, that when fds_gc() is started/running i get distorted audio which lasts until the garbage collection is finished. It soulds like the i2s interrrupt gets delayed too much and the audio data runs out. Probably the flash page delete takes too long time ?

I already tried to increase the I2S interrupt to priority 3, but that did not change anything.

Do you have any other idea on what i could try to improve this ?

  • well yes, from the product spec

    tERASEPAGE

    Time to erase one page

    2.05 89.7 ms

    and during page erase the CPU is halted so you have at least 2ms and at most nearly 100ms during which time there's no CPU work at all. 

    If you're using flash for this there's really not much you can do about it at all. The page has to be cleared, it's going to take some number of ms to do that and you're stuck with it. Your only option apart from storing the data in an entirely different place, eg a QSPI external memory or similar which doesn't stop the CPU when it's cleared I guess is to fade out the audio before a flash garbage collection and then fade it back it, at least it won't be distorted. Don't have a lot of better ideas. 

  • Thank you for this information. I did not know that the cpu is fully halted while pages are ereased.

    The data i am playing is in normal memory (i am not playing directly from flash) so dma to i2s should still work.

    I just made some experiments and i can reduce/remove the distortions if i increase the dma buffers to much bigger sizes so i do not run out of data while the cpu is blocked.

Related