5 Replies Latest reply on Sep 26, 2015 12:36 AM by Sriranjan

    Increase the speed of the ADC with CS

    AntoineElectric

       

      Hello,

      At the moment, I'm  working on the ADC of the card Intel Arduino Edison. During the tests, the speed of sampling is 9 kHz. I wish to increase this speed !!! The datasheet of Texas Intstrument ( ADS7951),informs that the conversion starts on each chipselect falling edge. CS is connected to edison's gpio110.

       

      How to drive CS with a clock (19.2 MHz, 32 kHz) or a PWM ?

      Thanks

       

      Have a good day.

        • 1. Re: Increase the speed of the ADC with CS
          Intel_Alvarado

          Hi,

           

          We will investigate how to do this. We will contact you as soon as we have more information.

           

          Sergio

          • 2. Re: Increase the speed of the ADC with CS
            Intel_Alvarado

            Hi,

             

            We need more information on how are you doing these tests. How are you testing the speed of the ADC? Are you using Arduino IDE or Linux/Python/MRAA? Please provide your testing code.

             

            Sergio

            • 3. Re: Increase the speed of the ADC with CS
              AntoineElectric

              Hello,
              This is the program. In comment is the filter FIR which I shall wish to use. Activeted or not, it does not change frequency of sampling (approximately 9 000 Hz).

               

               

              #include "mraa.hpp"

               

              #include <adc121c021.h>

               

              #include <iostream>

               

              #include <unistd.h>

               

              #include <spi.h>

               

              int main()

               

              // check that we are running on Galileo or Edison

               

              mraa_platform_t platform = mraa_get_platform_type();

               

              if ((platform != MRAA_INTEL_GALILEO_GEN1) &&

               

              (platform != MRAA_INTEL_GALILEO_GEN2) &&

               

              (platform != MRAA_INTEL_EDISON_FAB_C)) {

               

              std::cerr << "Unsupported platform, exiting" << std::endl;

               

              return MRAA_ERROR_INVALID_PLATFORM;

               

              // create an analog input object from MRAA using pin A0

               

              mraa::Aio* a_pin = new mraa::Aio(0);

               

              if (a_pin == NULL) {

               

              std::cerr << "Can't create mraa::Aio object, exiting" << std::endl;

               

              return MRAA_ERROR_UNSPECIFIED;

               

                 double FiltCoeff[40] = {0.003992971367783279,0.002671288927529426,0.000293648102035631,-0.003049641074785354,-0.007054249112312309,-0.011199313322262320,-0.014781202150908510,0.016983657348559327,-0.016978142798043196,-0.014042341239769666,-0.007680322238766472,0.002274135742007994,0.015588699880289214,0.031611863768851500,0.049307883185808074,0.067346559343409204,0.084238762551172366,0.098501199105692217,0.108828799960592457,0.114251167879893964,0.114251167879893964,0.108828799960592457,0.098501199105692217,0.084238762551172366,0.067346559343409204,0.049307883185808074,0.031611863768851500,0.015588699880289214,0.002274135742007994,-0.007680322238766472,-0.014042341239769666,-0.016978142798043196,-0.016983657348559327,-0.014781202150908510,-0.011199313322262320,-0.007054249112312309,-0.003049641074785354,0.000293648102035631,0.002671288927529426,0.003992971367783279};

               

                 int NumbOfCoeff = 40;

               

               

               

                 int i, j, k;

               

                 uint16_t y;

               

               

               

                 double* Reg;

               

                Reg = new double [40];

               

                 double * OutputTable;

               

                OutputTable =  new double [10000];

               

                 for(j=0; j<10000; j++)OutputTable[j] = ( a_pin->read());

               

                 /*

               

                 FILE * temp = fopen("data.temp", "w");

               

                 for (i=0; i<10000; i++)

               

                 fprintf(temp,"%d %lf \n",i,OutputTable[i]);

               

                 fclose(temp);

               

              return MRAA_SUCCESS;

               

               

              The conversion starts on each chipselect falling edge CS. But CS and SCLK are proportional ? If I modify SCLK speed of the bus SPI, it will increase the frequency of sampling ? Furthermore, how to modify the proportionality relationship between CS and SCLK ?

               

              Sorry for all these questions ! I wish you a good day. Antoine

              • 4. Re: Increase the speed of the ADC with CS
                Intel_Alvarado

                Hi,

                 

                The CS does not define the speed of the data transfer. The CS is asserted when data is transferring and de-asserted once the data transfer is complete. The SCK defines the speed of the data transfer. Using the MRAA SPI example, I was able to get a SCK frequency of 400 kHz. The MRAA SPI examples can be found https://github.com/intel-iot-devkit/mraa/tree/master/examples. If you require a higher speed I suggest for you to use the spidev instead of the MRAA library. Take a look at a previous post that might help you. Using The SPI Port Without the mraa Library Problems

                 

                Sergio

                • 5. Re: Increase the speed of the ADC with CS
                  Sriranjan

                  Hello Sergio,

                   

                  I am using MRAA with Ubilinux .I want to sample audio signals on the ADC. So the ADC needs to run at speeds like 2khz,4khz,8khz and 16 khz. So could you tell me how to get high speed ADC on the edison?