I am using SAI to input and output audio on a custom MCXN947 board.
I am using the demo program evkbmimxrt1060_sai_peripheral for FRDM-MCXN947, which I have modified to fit the custom board.
When this program outputs the input audio as is (recordPlayback.c operation), the audio stops midway.
There is no problem when I download it to RAM using the debugger and run it, but the problem occurs when I use XIP to start it from Flash and run it.
When I checked CH0_ES of the DMA TCD when it stopped, the Destination Bus Error (bit 0) was 1.
The DMA CH0 is used by the SAI TX, so I think the cause is that the DMA on the output side has stopped.
My question is, does the above error occur in connection with XIP?
Also, if you have any idea how to solve this problem, please let me know.
Best regards
Solved! Go to Solution.
Hi takagi_y
According to your feedback, the destination and source addresses should have no issue.
Flash memory XIP access times are slower than RAM. This can cause timing issues, especially for real - time audio processing. As I suggested in my first response, please enable LPCAC to optimize Flash performance, which can help code running in XIP have similar performance to that running in RAM.
You can also check DMA error status when the problem happens. It will help you locate where the problem is.
For testing purposes, you can set the DMA priority highest, keeping SAI and FlexSPI, bypass all other peripherals and interrupt to isolate other possible interactions. See how it works.
Hope this helps,
Jun Zhang
Hi takagi_y,
DMA TCD's CH0_ES (bit0=1) indicates that there was an issue with the destination bus during the DMA transfer.
By default the running speed in Flash in slower than running in RAM. The slow access time of the flash can cause the DMA controller to wait for data for too long. This might lead to the bus conflict, a timeout or an inconsistent data transfer.
I suggest you enabling LPCAC to optimize Flash performance. For detail, please see MCXN947 reference manual and AN14139
https://docs.nxp.com/bundle/AN14139/page/topics/introduction.html
In addition, we need to check your DMA configuration. Make sure DMA has right to access the right source and destination addresses.
Thanks,
Jun Zhang
Thank you for your reply.
I think the source is RAM and the destination is SAI, but will XIP affect it?
Currently, I can play the first time, but the playback stops halfway through after the second time.
The destination and source addresses are the same for the first and second transfers, so I think the access rights do not change.
I also tried changing the priority with SYSCON_AHBMATPRIO, but that did not improve the situation.
Could you give me some hints on how to solve this problem?
Best regards
Hi takagi_y
According to your feedback, the destination and source addresses should have no issue.
Flash memory XIP access times are slower than RAM. This can cause timing issues, especially for real - time audio processing. As I suggested in my first response, please enable LPCAC to optimize Flash performance, which can help code running in XIP have similar performance to that running in RAM.
You can also check DMA error status when the problem happens. It will help you locate where the problem is.
For testing purposes, you can set the DMA priority highest, keeping SAI and FlexSPI, bypass all other peripherals and interrupt to isolate other possible interactions. See how it works.
Hope this helps,
Jun Zhang