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.

Using the Sensor Controller for ADC sampling


now, I use the Sensor Controller to ADC sampling , using adcStartAuxTimer0Trigger triggered, but now I met a 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? Or any other method to implement the sampling rate (22050Hz).

  • Hello User,

    Can you show me your execution code (from SCS)?

    The achieve this you would need to keep the sensor controller powered and running continuously. The sensor controller domain need more than 100 us to wake up from sleep. When the sensor controller enters sleep, the AUX domain is clocked by the 32 kHz clock which has a period of around 30+us. When the sensor controller is active and running it is clocked on 24 MHz.

     Try to either use manual trigger or reduce the tick period in the following call:

    scifStartRtcTicksNow(tick interval);

  • Thank you for your reply!
    Below is my code(from SCS)
    I use the multiple buffers and buffer number is 3.
    because I need 22050Hz Sample rate,if use the manual trigger ,How to realize the sampling rate?

    ///////////////initialization code////////////////
    // Select ADC input
    adcSelectGpioInput(AUXIO_A_SAMPL_ADC);
    gpioClearOutput(AUXIO_O_SAMPLE_PWR);
    adcEnableAsync(ADC_REF_FIXED, ADC_TRIGGER_AUX_TIMER0);

    adcStartAuxTimer0Trigger(45);

    // Schedule the first execution
    fwScheduleTask(1);

    ///////////////////////execution code//////////////////////////
    while(output.head < ADC_SAMPLE_BUF_LEN) {
    U16 n = output.head;
    adcReadFifo(output.AdcSampleBuf[n]);
    // utilIncrAndWrap(n, ADC_SAMPLE_BUF_LEN; output.head);
    utilIncrAndSat(n, ADC_SAMPLE_BUF_LEN; output.head);
    }

    fwSwitchOutputBuffer();
    //fwGenAlertInterrupt();

    // Schedule the next execution
    fwScheduleTask(1);

    ////////////////////////////terminate code//////////////////////////////////////
    adcStopAuxTimer0Trigger();


    ////////////////////////////RTOS CODE/////////////////////////////////////////
    scifBtwatchStartRtcTicksNow(1100); // about 16784 us

    thanks!
  • Hi,Eirik

    I made many attempts, still not solve the problem, can you help me?

  • Hello,

    You need to lower the tick interval from the RTOS code. I think the interval argument in adcStartAuxTimer0Trigger is based on this intenal interval. Reduce from 1100 to an appropriate interval.

    scifBtwatchStartRtcTicksNow(1100); // about 16784 us

  • Thank you for your reply!

    the sensor control is run in 24MHz, I think adcStartAuxTimer0Trigger  is based on 24MHz,I verified this problem.