4 Replies Latest reply on Feb 6, 2017 2:23 PM by Intel Corporation

    How fast can I sample to GPIO's? Can I write the results to RAM via DMA?

    dnhkng

      I want to do some medium-speed data recording and processing (~10MHz). Can I use the Joule to capture from a fast parallel ADC to memory with DMA?

        • 1. Re: How fast can I sample to GPIO's? Can I write the results to RAM via DMA?
          floydg

          What is the architecture?

          Most ADCs are SPI or I2C.

           

          The performance depends on the sw and hw architecture as well as the joule mraa capabilities, or custom drivers. As well as the OS architecture, compiler optimization, idle percentage, ISR priority settings, ...

           

           

          Scenario 1:

          If you you connect the ADC EOC (End Of Conversion) pin to a Tuchuck J12/J13  ISR GPIO input pin on the Joule. The ISR could attempt to transfer each conversion, but with a 25MBit SPI Clock , a 10MHz sample rate is inadequate. If the ADC has an internal buffer, and the ADC generates an interrupt when the buffer is 3/4 full, multiple transfers can occur withing the ISR.

           

          Scenario2:

          ADC parallel bus output, the joule GPIO is not grouped as a contiguous byte or word as far as I am aware. If the ADC generates an interrupt on EOC, the ADC_ISR GPIO input pin, will trigger the ISR handler, and a parallel read (or multiple bit reads) can be performed to save/buffer the ADC value.

          • 2. Re: How fast can I sample to GPIO's? Can I write the results to RAM via DMA?
            dnhkng

            Definitely scenario 2. Do i have DMA access? I want to record a few seconds of data at 10+MHz, and i dont want an OS messing up my timing

             

            Do you know the maximum speed i can read a GPIO? I don't suppose i can read it at up to the processor speed...

            • 3. Re: How fast can I sample to GPIO's? Can I write the results to RAM via DMA?
              floydg

              Here is some metrics for GPIO writes using nodejs and c++. Have not tested GPIO performance, as of yet with various languages (python).

               

              you may want to look at:

              DMA SPI 8 bit write working in 3.10.17

               

               

              Ubuntu Core, sudo classic, sudo nodejs gpioTest.js                 // note: these results of 10.6us were the same for a C++ executable looping on write 0, write 1

               

              period is ~10.6us, such that a single write requires ~5.3us

               

              sudo nodejs gpioTest.js

              MRAA Version: v1.5.1

               

               

              var m = require('mraa'); //require mraa

              console.log('MRAA Version: ' + m.getVersion()); //write the mraa version to the console

               

              var myPin= new m.Gpio(2);

              myPin.dir(m.DIR_OUT); //set the gpio direction to output

              var pinState= true; //Boolean to hold the state of the pin

               

              while(1)

              {

                myPin.write(ledState?1:0);

                pinState= !pinState; //invert the pin

              }

               

              or:

              using -

              while(1)

              {

                myPin.write(1);

                myPin.write(0);

              }

              is typically the same ~10.6us (notice the short period high which occasional hits: ~15us)

               

              • 4. Re: How fast can I sample to GPIO's? Can I write the results to RAM via DMA?
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                Hi Dnhkng,

                Did you check Floydg information? (Thanks by the way Floydg) 

                Do you still need help in this case?

                Have a nice day.

                Regards,
                Leonardo R.