rt685 HiFi4, erratic DSP code bahaviour when loaded from MCU

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

rt685 HiFi4, erratic DSP code bahaviour when loaded from MCU

287 Views
witali_z
Contributor II

Hi, 
I am working on a audio processing demo that runs on a R685-AUD-EVK. I have followed the getting started resources, the MCU and DSP FW is mostly based on "audio_demo_bm" from the SDK.

MCU FW only does basic initialization of GPIOS for a simple user interface.
DSP FW intializes the I2S and DMA for audio input/output, data is buffered using the "triple buffer" approach as suggested in one of the NXP application notes.
The actual audio processing function is called from the I2S/DMA receive ISR once 1ms of audio data (i.e. 48 left and 48 right samples) has been received.
Processing of audio data uses the natureDSP library functions. 

So far everything runs as expected when MCU FW and DSP FW are built and run in Debug mode, but I am observing issues when the DSP FW is loaded from the MCU (Release build, DSP_IMAGE_COPY_TO_RAM = 1).

When the audio processing function (called from the ISR) is placed in ".iram0.text" (instruction TCM memory) the DSP FW runs into an exception.
xt-ocd prints:

Error: Exception details: exccause:0x0, excvaddr:0xff0042, epc:0x240205bc, epcdbg:20e022

This does not happen if the function is placed in non-TCM memory, or if the DSP FW is loaded in debug mode.

Is there anything to look for that may explain the observed issue?
Could this be related to alignment in memory?

Labels (1)
0 Kudos
Reply
2 Replies

238 Views
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Alignment issue could be a potential issue, I see that this does not happen if it is built for debug.
When building for release, the compiler may add some optimization levels, which can affect how the example works.
If the MCU doesn't properly copy .iram0.text or align it, the DSP may fetch invalid instructions—leading to the exccause: 0x0 (illegal instruction).

Best regards,
Omar

0 Kudos
Reply

155 Views
witali_z
Contributor II

@Omar_Anguiano  thank you for your reply.

I found out, that the post_build script does not copy the ".iram0.text" section into the binary file which is included into the MCU code, so the actual function code was not present in the memory.
I have not looked further into alignment issue, as I can currently continue to work with "debug" mode.

BR Witali 

0 Kudos
Reply