6 Replies Latest reply on May 7, 2015 4:22 AM by ruben_vleuten

    Set clockspeed Edison to max (arduino IDE)

    ruben_vleuten

      Hi,

       

      I'm playing around with a RGB Led strip and want to control a big amount of LED's (approx. 1000). In order to increase the framerate I'd like to increase the clockspeed. How can I set the clockspeed to it's maximum (I believe 32Mhz) using the Arduino IDE? Can I use the SPI.setClockDivider(); function. Or is there another way to do this?

       

      Cheers,

       

      Ruben

        • 1. Re: Set clockspeed Edison to max (arduino IDE)
          CMata_Intel

          Hi ruben_vleuten

           

          In order to change this speed you can use the function setClockDivider(), for example:

          SPI.setClockDivider(SPI_CLOCK_DIV2)
          

          Take a look at the SPI.cpp and see the options available:

          #define SPI_CLOCK_DIV4 0x00
          #define SPI_CLOCK_DIV16 0x01
          #define SPI_CLOCK_DIV64 0x02
          #define SPI_CLOCK_DIV128 0x03
          #define SPI_CLOCK_DIV2 0x04
          #define SPI_CLOCK_DIV8 0x05
          #define SPI_CLOCK_DIV32 0x06
          #define SPI_CLOCK_DIV1 0x09
          

           

          Chech the SPI.cpp in there you can also change the default speed, that is 4Mhz

          #define SPI_CLK_DEFAULT_HZ 4000000
          

           

          Which IDE version are you using?

           

          Regards;

          CMata

          • 2. Re: Set clockspeed Edison to max (arduino IDE)
            ruben_vleuten

            Hi CMata,

             

            Thanks for the Quick reply. I'm using the Arduino 1.5.3-Intel 1.0.4 IDE. Is this of any influence? And what is the maximum clock speed achievable?

             

            I've been looking for the SPI library:

                               

                           Arduino -> package contents -> resources -> java -> libraries -> SPI -> arch

             

            And then I could find the SPI.cpp in both the AVR as the SAM folder. Then in the SPI_CLASS.h file in the AVR folder I could fine the following list:

             

            #define SPI_CLOCK_DIV4 0x00
            #define SPI_CLOCK_DIV16 0x01
            #define SPI_CLOCK_DIV64 0x02
            #define SPI_CLOCK_DIV128 0x03
            #define SPI_CLOCK_DIV2 0x04
            #define SPI_CLOCK_DIV8 0x05
            #define SPI_CLOCK_DIV32 0x06
            //#define SPI_CLOCK_DIV64 0x07
            

             

            which is a bit different than you describe (it's missing the DIV1, which would be the best). Also it's only in the AVR folder, and I thought the Edison is not using the AVR related libraries. Further I could not find the how to change the default clock speed. In what file/ folder is this supposed to be

             

            I'm sorry if i'm asking trivial questions, but would be great if you could help me out,

             

            Cheers,

             

            Ruben

            • 3. Re: Set clockspeed Edison to max (arduino IDE)
              CMata_Intel

              Hi ruben_vleuten

               

              Please post all your doubts and questions, we will be glad to help you.

              You have to search for the arduino-1.5.3-Intel.1.0.4 folder in your PC, then Go to \hardware\arduino\edison\libraries in there you will find the SPI libraries.

              I think you are looking in the Arduino folder for AVR boards and not in the Arduino folder related to the version that supports Intel boards.

               

              Also, the maximum clock speed achievable is 25MHz .Check the Hardware Guide for the Edison Compute Module for more information about SPI

               

              Regards;

              CMata

              • 4. Re: Set clockspeed Edison to max (arduino IDE)
                LeonY

                What LED strip are you using? And what model driver does it contain?

                • 5. Re: Set clockspeed Edison to max (arduino IDE)
                  ruben_vleuten

                  I'm using the Apa102 LED strip, together with the ADAfruit DigiDot library

                  • 6. Re: Set clockspeed Edison to max (arduino IDE)
                    ruben_vleuten

                    I've been playing with the clock-speed settings and though it compiled, it did not seem to influence the actual clock-speed. For me it's not relevant anymore, and only did limited testing, since I can run at the default clock-speed. But might be worth looking at regardless.