This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DSP/BIOS KNL_swi Idle_busyObj variable task load



Hello,
I have created a DSP/BIOS 5.42.0.7 application in CCSv5.3 project for ezDSP5535 USB kit. I have basically 2 tasks, apart from the main initialization task that is finalized at the beginning of execution: 
1. An Audio task based on the C55 Audio Framework that synchronizes using semaphores with the audio codec I2S Tx interrupt (HWI8) and Rx DMA (based on ddc i2s bios driver)
The Audio task reads audio samples at 16kHz  using a 2x64 ping-pong buffer, adds a long delay effect and then, writes the resulting samples in another 2x64  ping-pong buffer.
2. An MMCSD task that writes and reads buffers of 256 samples from SD card. To store the delayed samples, since large buffers are not supported by memory provided on ezDSP5535, I am trying to use the SD card.
I have adapted CSL_MMCSD_dmaExample to write and read chunks of 256 samples (since SD card buffer size is 512bytes)
The MMCSD task executes once for every 4 loops of Audio task. After four Audio task loops, 4x64=256 samples just read from audio codec are written into SD card. At the same time 4x64 = 256 delayed samples are read from SD card and stored into a DelayBuffer in memory.
Semaphores are used to synchronize Audio task and MMCSD task.
The first disappointment is that it seems that SD card does not seem to offer enough bandwidth to work at 48kHz, so I had to switch to 16kHz, though CPU load is around 20. Even though sometimes I observe TX FIFO UNDERFLOWS: the Tx interrupt arrives but their corresponding samples have not been prepared yet.
But the most serious issue I am facing is that during the first minute of execution there are many UNDERFLOWS, CPU load is 85 or more, KNL_swi average load is 2,700 and Idle_busyObj is 14,000. But after a minute of execution, when CPU time is around 70, the CPU load diminishes drastically to around 20, and the load of the previous tasks is inverted, KNL_swi is around 13,000 and Idle_busyObj is around 2,700.
Why is this? What I am doing wrong? How can identify what tasks are running? Is there a way to list task code execution order? I find the debugging options quite limited for C5535. I have not been able to make Thread Log to work.
I have added LOG_printf traces, STS functions, and even added THRLOAD to be able to obtain task loads, but it doesn't help. 
  • I could upload the CCSv5 project of this application if somebody wants to have a look at it.

  • Diego,

    Sorry to take so long to reply. Have you made any progress on this issue?

    Alan

  • Not really, I have decided to implement DMA with ping-pong buffers on TX to see if I can reduce CPU load, since today I am reusing code from the Connected Audio Framework that uses a sample by sample interrupt for TX. For some reason, I am having synchronization issues. But I don´t know why the task load changes after one minute, there is no other task running.

  • The KNL_swi gets usually posted to perform task switching operations as a result of a formerly blocked task becoming ready to run.

    I assume that your application has tasks pending on semaphores that are being posted within HWI functions.

    Consequently, I'm thinking that for some reason, your application has a much higher interrupt rate during the first minute of operation than later on.

    Is this possibly a data-dependent issue? I mean could the processing burden of individual audio frames be higher for the first minute of the audio stream?

    Alan

  • There are 2 HWI used. One is the I2S RX that receives the input samples from ADC, which is configured as a DMA with ping-pong buffers of 64 samples, the other one is the I2S TX that transmit samples to the DAC, which is configured as a sample by sample interrupt as in the Common Audio Framework.

    Apart from that there is an SD card task that writes and reads 256 sample buffers and communicates via semaphores, but I don´t see change in load on it.

    The thing is that actually during the first minute when there are many underflows the load of KNL_swi is low and idle_BusyObj is high, It is when the load of KNL_swi is high after one minute that things work better with no underflows.