Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CC2640R2F: PWM & DMA Optimization for Audio Streaming as PWM DAC..

$
0
0

Part Number:CC2640R2F

Hi Team BLE,

My customer is using a PWM as an audio PWM DAC and looking to optimize feeding the PWM w/ duty cycle updates w/ DMA.

More detail..

Using the DMA to ping pong a couple of small buffers so that I can keep feeding the PWM (w/ Audio data) on timer interrupt, but looking for an improvement WRT algo performance.  Once the audio is started we service the timer interrupt and the DMA finished interrupt. 

Is it possible to get the SPI DMA to update the PWM duty cycle register directly at the given update interval.

Current method:

playSound(1)

{

READ first 100 bytes from SPI Flash into buffer1;

Setup timer for sample freq of audio / 2;

Set first byte of audio as the PWM duty cycle;

StartPWM

StartTimer

}

Timer_Int()

{

move currentIndex byte into PWM duty cycle register

if(currentIndex > bufferSize/2)

Read next 100 bytes into buffer2 //// This sets up a DMA read of the SPI

}

Then bounce back and forth with the two buffers until the sound has been played.  This works but have to handle two interrupts. (DMA SPI Read and Timer)

Is it possible to do something like this:

PlaySound(1)

{

Setup SPI DMA to read from SPI Flash at my audio sample rate and write into the PWM duty cycle register.

Start PWM

Start DMA transfer;

}

With this method, would not have to handle any interrupts. But, can the DMA only read one byte at a time and read each byte at a given sample rate?

Thanks, Merril


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>