4 Replies Latest reply on Jul 14, 2014 9:18 AM by jjaken

    How to measure GPIO speed

    Tim2

      Hi,

       

      I'd like do some tests on GPIO speed, I'm just curious. Is it possible to get an indication of GPIO speed using an Arduino sketch maybe using timers?  I don't have an oscilloscope

      If so, would somebody be willing to provide an example to measure a pin speed?

       

      Tim

        • 1. Re: How to measure GPIO speed
          jjaken

          I used this sketch to measure practical differences between Arduino and Galileo.  It counts loops per second while doing an SPI call (function brings SS pin low and calls SPI.transfer).  I was using it with the can-bus shield, which requires a library to be imported.  However, you don't need the shield to perform this test.  If you want to avoid the library stuff, go ahead and modify it with any function calls you want.

          • 3. Re: Re: How to measure GPIO speed
            Tim2

            Hi jjaken,

             

            Thanks for your reply. Exactly what I'm looking for. But I don't quite follow

             

             

            If you want to avoid the library stuff, go ahead and modify it with any function calls you want.

             

            I would prefer not to use the CANbus shield library. What function would you recommend to test the gpio speed?

             

            Thanks

            Tim

            • 4. Re: How to measure GPIO speed
              jjaken

              Hi Tim2,

               

              Sorry, I should have been more clear.  You can call any function that is a SPI read/write.  I would pick one that simply transfers data, nothing fancy, you would need to peek inside the library to see that. 

               

              If you wanted to write your own, it's simple.  In every SPI read/write function SPI.transfer or SPI.transferBuffer are called.  You'll notice that the chip select is cycled about the transfer, forexample:

              chipSelect LOW

              transfer

              chipSelect HIGH

               

              That process is needed for any SPI read/write. 

               

              It's not entirely clear, but the slow down is either in the cycling of the chip select, or somewhere in the data transfer process (linux driver).  It's probably a little of both.