AnsweredAssumed Answered

Audio ADC/DAC timing/sampling questions

Question asked by miller.mike.003 on Apr 25, 2014
Latest reply on Apr 29, 2014 by miller.mike.003
All,

1.) I took 128,  16-bit data points and created a sine wave:

const uint16_t Sine12bit[128] = {
  2047, 2447, 2831, 3185,
  3498, 3750, 3939, 4056,
  4095, 4056, 3939, 3750,
  3495, 3185, 2831, 2447,
  2047, 1647, 1263,  909,
  599,  344,  155,   38,
  ....
   4095, 4056, 3939, 3750,
  3495, 3185, 2831, 2447,
  2047, 1647, 1263,  909,
   599,  344,  155,   38,
     0,   38,  155,  344,
   599,  909, 1263, 1647};


2.) I broke this into 256 bytes (8-bits) and wrote out to a page (1 page = 256 bytes) of my SPI based serial flash.

3.) I then wrote out this same data to all the other pages of my SPI based serial flash. There are a total of 16,384 pages.


4.) I am then reading each page at a time playing a tone (the waveform) out with the DAC. Using a combination of the
DAC,Timer2, DMA, and interrupts.


5.) When I measure the frequency of the generated waveform, it looks nice an clean with a frequency of 6.25kHz.

6.) For the Timer2 configuration the period is setup usign the following line:

 Period = (SystemCoreClock / 200000); //  6.25 KHz Sine
 
 The SystemCoreClock is 48 MHz.


7.) When I play this tone reading for all the pages of memory it only lasts about 10 seconds.


8.) I am not clear on a few things:


- I don't see how I can get 6.25 kHz based on the line above.  48MHz / 200000 = 240. 1/240 = 0.0041?

- Based on the size of the pages of memory (256), total memory size (16,384 pages) and the timer2 settings above how long should it take to read through the entire memory? The 10 seconds seems too short.


- For recording and playign back voice I want to be operating at a 16 kHz for the sample rate.  If I am sampling 128 (16-bit) values from the ADC and write out 256 bytes to my SPI flash how should the timer be setup?  What should the divider be?


- How much recording time should I get with a sample rate of 16 kHz?

- Any other suggestions to help my understanding?

Thanks.

-Mike

Outcomes