7 Replies Latest reply on Apr 5, 2016 9:33 AM by FGT

    Sleep vs Delay effect on  UART read/write

    KS_Nathan

      Hey guys, I was actually wondering as to whether there is a delay function for galileo(Not sleep)?

      The major difference between them from my experience of arduino and galileo, is that sleep pauses the entire CPU for that amount of time whereas delay also does something simlar to that but allows other functions to run in the mean time.

      For example I am working on the UART port in the galileo.So now when I am performing a sleep function during a uart_read, does that mean whatever is the incoming bytes on the rx pin will be ignored ?

      But in the case of arduino I had never encountered such a problem

      Finally I have two questions

      1.Is there a C library for delay function

      2.Clarity on sleep vs delay

       

      Thanks

      nathan

        • 1. Re: Sleep vs Delay effect on  UART read/write
          FGT

          Hi,

           

          Are you asking about an alternative for Arduino sketches running in Galileo?

          The major difference between them from my experience of arduino and galileo, is that sleep pauses the entire CPU for that amount of time whereas delay also does something simlar to that but allows other functions to run in the mean time.

          How do you figure out this behavior? Arduino and Galileo?

           

          Fernando.

          • 2. Re: Sleep vs Delay effect on  UART read/write
            KS_Nathan

            Actually I treid using sleep in the case where, I had to write consecutive AT commands with a delay in between.

            Also during this sleep time I wanted to read the reply from the uart device

            which was not possible when I used sleep in galileo.

             

            delay is not there by default in galileo c programming.

            correct me if I am wrong

             

            Do u know any equivalents of delay in galileo?

            • 3. Re: Sleep vs Delay effect on  UART read/write
              FGT

              KS_Nathan wrote:

               

              Actually I treid using sleep in the case where, I had to write consecutive AT commands with a delay in between.

              Also during this sleep time I wanted to read the reply from the uart device

              which was not possible when I used sleep in galileo.

               

              delay is not there by default in galileo c programming.

              correct me if I am wrong

               

              Do u know any equivalents of delay in galileo?

              Hmmm... I think I do not fully understand... how are you developing your applications? what IDE are you using (or none)? 

               

              Maybe it's not the most elegant:

               

              do {

                 receive from UART, if something available

              } while not elapsed the delay

               

              HTH,

               

              Fernando.

              • 4. Re: Sleep vs Delay effect on  UART read/write
                KS_Nathan

                I am using Eclipse IDE

                • 5. Re: Sleep vs Delay effect on  UART read/write
                  FGT

                  KS_Nathan wrote:

                   

                  I am using Eclipse IDE

                  This is why I didn´t understand, I don't use Eclipse. I won't be able to help, sorry.

                   

                  Fernando.

                  • 6. Re: Sleep vs Delay effect on  UART read/write
                    KS_Nathan

                    K have u been able to use arduino ethernet library with galilleo?

                    coz I am having trouble working with it.

                    Whenever I am trying to print the ethernet.LocalIp() it is giving 255.255.255.255

                    Any references/suggestions/solutions from your side?

                    nathan

                    • 7. Re: Sleep vs Delay effect on  UART read/write
                      FGT

                      KS_Nathan wrote:

                       

                      K have u been able to use arduino ethernet library with galilleo?

                      coz I am having trouble working with it.

                      Whenever I am trying to print the ethernet.LocalIp() it is giving 255.255.255.255

                      Any references/suggestions/solutions from your side?

                      nathan

                       

                      I think there is no way of using that library's specific function ... Galileo causing problem with arduino ethernet library

                       

                      If you are not setting the IP and you want to know the IP received by the DHCP server, then you should use some other method... e.g. some system() command

                       

                      If you set the IP (a static one) then you do not need to get the IP from the library.

                       

                      HTH,

                       

                      Fernando.