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.

CC3235SF: I2S data transfer without switching thread

Part Number: CC3235SF

Tool/software:

Hi team,

I am using CC3235SF microcontroller for my project. I have one question. I want to transfer data on i2s to play an audio file using DMA and without context/thread switching temporarily. There are other task running in parallel such as WiFi task,SlNetConn_process,slspawn task and three tasks defined by me.

When i am running only one task that play audio + WiFi task, i am able to hear audio clearly but when i am running another tasks in parallel audio is not playing properly.Its getting slowed down and so much noise is coming.

What i want to achieve,i want to disable cpu scheduler temporary/disable context or thread switching temporarily and enable cpu scheduler/context or thread switching later after audio play gets finished.How i can achieve this in posix thread? I am using sdk -> simplelink_cc32xx_sdk_6_10_00_05.

I am reading mp3 file from internal flash and then decoding it into pcm pulses and sending data over i2s.

I am setting priority of thread which is playing audio,WiFi thread,sl_spawn to 9 and another thread's priority to 1.

  • Hi Vinod,

    I believe that the i2s driver should already have support for DMA. Probably I would not suggest having three threads at priority 9, and to spread them out. I would also recommend starting with one task and then slowly add another, then you can begin to identify bottle necks.

  • Hi Sabeeh,

    CC3235SF support DMA for I2S data transfer.That part is working fine.

    In my use case,it takes time to convert one mp3 frame to pcm format(around 10-11msec). I am using four buffers to transfer mp3 decoded file. I initiate a i2s transaction using list after adding these four buffer with audio sample data and after transfer of every buffer,i send the semaphore from writecallback to the task to fill that buffer which has been sent and keep doing these till the complete mp3 file gets decoded and sent.I am using DMA for i2s data transfer so i am able to load data in parallel while data is being sent via DMA. 

    Now if this data conversion gets interrupted due to context switching and as a result if data is not loaded in buffer on time then wrong data will be transferred over i2s resulting in noise and unclear audio output.So,the requirement is to load the buffer on time asap before its turn come back.

    To achieve this,i want to disable context switching temporarily and after sometime i want to resume it. Is there any way to run a critical section of code without thread/context switching and interrupt?
    e.g -> taskENTER_CRITICAL(); // Enter critical section
    // Critical section code here
    taskEXIT_CRITICAL(); // Exit critical section

    HwiP_disable();-will this work?

  • Hi Vinod,

    That function disables all hardware interrupts. Are you using FreeRTOS or TI-RTOS?

  • Hi Sabeeh,

    Thanks for your reply. The issue was with optimization level. I have changed compiler optimization level from off to level-3 interprocedure optimizations. After this, my issue has been resolved.