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.

CC2640 ADC Sample for 22050Hz

Other Parts Discussed in Thread: CC2640, BLE-STACK

Now I need to use CC2640 internal ADC acquisition an audio signal, the requirements of the sampling rate of 22050 hz / 8 bit.
Based on the information I can see (data sheet and software Api), also don't know how to configure the realization of this function.
I need you help, thanks!

  • Hi,

    I recommend using Sensor Controller Studio to configure the ADC.

    Cheers,
    Fredrik
  • Hi! Fredrik
    thanks you answer!
    I try to use Sensor Controller Studio to configure the ADC,
    But I didn't found configuration ADC sampling method, can you provide further instructions?
  • The API adcStartAuxTimer0Trigger / adcStopAuxTimer0Trigger can be used to generate periodic ADC samples. An exact 22050Hz sample rate will not be possible to derive from a 48MHz clock source unfortunately.

    Regards,
    Svend
  • I'm Sensor Controller Studio help document API adcStartAuxTimer0Trigger/adcStopAuxTimer0Trigger found you said, but I didn't find them in the Ble - stak definition and declaration, also cannot call.How to apply it to Ble - satck - 2-1?
  • You use them in the Sensor Controller Studio code, not in the BLE-stack. See the ADC examples included with Sensor Controller Studio on how to retrieve the samples into the Cortex M3 RAM after sampling.
  • hello! Using the sensor controller studio to generate code to add to the BLE - Stack of engineering?
    I use the IAR. Is there a relevant guidance document?

  • Yes, there are IAR examples included in the installer with Sensor Controller Studio. Documentation is included inside the program.
  • The generated code, there is a IAR engineering I compiled and downloaded, can run normally.
    now, I want to add the generated code to - in the BLE-Stack.
    Copy the generated code and loaded into the IAR projects can?
  • Yes, that is correct.
  • Thank you for your answer patiently!
    I had no contact with this kind of collaborative work with multiple processors MCU, so for me to understand the M3 and Sensor Controller work together with some difficulties.
    Now with the help of the document is too simple, I want more than the help document the use of tutorials about Sensor Controller Studio, where can I get these?
    It is better for tutorials, step by step.
  • Hi
    I now use the Sensor to ADC sampling Controller, using adcStartAuxTimer0Trigger triggered, but now I met a new problem, Sensor Controller not so fast to read the sampling results, I need 22050 hz sampling rate, and the Sensor Controller fastest task scheduling can only achieve 16384 hz. Is there any way to speed up the task scheduler?
  • Hi,

    The input to adcStartAuxTimer0Trigger is in microseconds so you should be able to sample at up to 200kHz.
    When doing sampling at this rate you need to stay in the task all the time while sampling as there is not enough time to finish the task and wake it up again before a sample is done.

    Regards,
    Svend
  • Yes, sampling speed can reach my request now, now I need to quickly retrieve the data, but I found that the frequency of the M3 awakening for 1/240 hz, and the correct awakens the frequency should be 1/23040 hz. Can you tell me where the problem is.Below is I now read the data code.

    adcStartAuxTimer0Trigger(45);
    ADC_SAMPLE_BUF_LEN=512;

    while ( output.head < (ADC_SAMPLE_BUF_LEN-1) ) {
    adcGetFifoStatus(adcState);
    adcEmpty = (adcState & BV_ADC_FIFO_EMPTY);

    if(adcEmpty != BV_ADC_FIFO_EMPTY){
    n = output.head;
    adcReadFifo(output.AdcSampleBuf[n]);
    utilIncrAndWrap(n, ADC_SAMPLE_BUF_LEN; output.head);
    }
    }