6 Replies Latest reply on Mar 9, 2017 10:57 AM by Intel Corporation

    Arduino IDE: TimerThree library

    APetrov

      Hello,

       

      I was wondering, if the TimerOne.h library works with the intel Edison, is it possible that the TimerThree.h library also works? I just need two timers for my project. I would be happy if anybody has an idea how to work around this problem. It cannot be that the MCU has only one internel timer/counter.

       

      Regards,

      Alex

        • 1. Re: Arduino IDE: TimerThree library
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello Alex,

          Thank you for interest in the Intel® Edison Breakout Board.

          Unforunately, the TimerThree.h can’t be implemented in the Edison. This is due to the fact that the library is architecture related, TimerThree.h uses the three hardware timers available on the ATmega168/328.

          The Edison module doesn’t use timers/counters like the Arduino, this is also related to architecture differences. As stated here https://learn.sparkfun.com/tutorials/sparkfun-blocks-for-intel-edison---arduino-block, The Edison module is running an operating system, so it’s incapable of real-time processing. Components which require precise timing may be incompatible with the Edison as they can’t reliably generate clock signals.

          This discussion presents various topics regarding timing/counting with the Edison module: https://communities.intel.com/thread/98062, I’ll recommend you to check it out.

          Have you checked the Blink without delay tutorial? It presents an alternative to doing two procedures at once (https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay).

          And if you are willing to try a Linux oriented solution, please check the following link on how to create timing routines: https://madalanarayana.wordpress.com/2014/01/25/create-your-own-timer-routine-in-linux/.

          I hope you find the previous information useful, please let me know if you need further assistance. 

          Regards,
          Andres V.

          • 2. Re: Arduino IDE: TimerThree library
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Hello Alex,

            I was wondering if you had the chance to check the information provided.

            If you have any other question, don’t hesitate to contact us.

            Regards,
            Andres V.

            • 3. Re: Arduino IDE: TimerThree library
              APetrov

              Hello Andres,

               

              I changed the arduino TimerThree.h library similar to the TimerOne.h and both of them work fine for big delays, but for smaller ones they dont! I have to produce clock signal with a frequency of 1MHz and parellel to it I want to send some addresses, so I am not sure if the edison is capable of this? Do you have an idea?

               

              Best Regards,

              Alex

              • 4. Re: Arduino IDE: TimerThree library
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                Hello Alex,

                Thank you for the information provided.

                Could you please tell me what is the maximum frequency that you have generated with the TimerThree.h library?

                Have you considered using the clock output with a frequency divider in order to obtain the 1 MHz signal and then, simultaneously, send the desired addresses?

                Also, did you had the chance to check the Blink Without Delay link provided in the last post?

                If you decide to share more details about your project or the way you modified the TimerThree.h libray, I may be able to assist you better.

                Please let me know the outcome of the previous suggestion.

                Regards,
                Andres V.

                • 5. Re: Arduino IDE: TimerThree library
                  APetrov

                  Hello Andres,

                   

                  Thank you for your response!

                   

                  The maximum frequency that I got with either the TimerOne.h or the the TimerThree.h was about 270KHz. And this is when I made the Timerx.initialize(1) - 1 microsecond. This had to give me an output PWM signal with at least 500KHz frequency, because I am toggling every microsecond. I believe a problem could be that digitalWRITE takes also about 2 microseconds at least on the arduino. So I would need direct port control in order to be able to manipulate the IO pins as fast as possible. I couldn't find how to do that on the Edison board.

                   

                  I don't think a frequency divider will help in our case because I want to be able to send exactly 416 clock pulses with the frequency of 1MHz.

                   

                  The BlinkWithoutDelay example wont be any good because it gives you the time in milliseconds and one period of 1MHz is 1 microsecond.

                   

                  Actually the libraries TimerOne and TimerThree cannot help me a lot. I need an interrupt every 0.5 microseconds in order to toggle the IO pin with the desired frequency. What I really need is direct control of the internal timers on the board but I do not think this is possible on the Edison board because of the closed architecture or lets say because of the lack of a thorough data sheet about all the registers and hardware of the MCU on the board.

                   

                  I do not know how elso to do that. My project has 3 simple signals one of them is the 416 Pulses 1MHz CLK, the second one is an address consisting of 416 Bits and the other one is just a reset which has to have a HIGH pulse before the CLK and then has to always be LOW. The only requirement is that the clk HIGH pulses come a bit delayed after each address bit.

                   

                  Best Regards,

                  Alex

                  • 6. Re: Arduino IDE: TimerThree library
                    Intel Corporation
                    This message was posted on behalf of Intel Corporation

                    Hello Alex,

                     

                    Thank you for the information provided, now I have a better understanding of your project.

                     

                    I’m aware that you want to use the internal timers of the board, but as I previously stated, since the Edison Compute Module is running an operative system, real-time processing is not an option.

                     

                    The approach you are trying to follow seems more “Arduino-oriented” in terms of accessing and modifying the internal timers/counters.

                     

                    Reliable high frequency clock signals (like the ones you seem to require for your project) may be incompatible with Edison’s architecture.

                     

                    Regards,
                    Andres V.