This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

1 us delay generation

Note: This was originally posted on 11th May 2011 at http://forums.arm.com

Dear all,

             I am using Linux OS  with arm-elf tool chain.  I am not able to generate 1 us delay using 'for loop' method of 'C' programming language.Is there anything that i can try?



thanks & regards
   Avadhoot
Parents
  • Note: This was originally posted on 11th May 2011 at http://forums.arm.com

    sleep() can be used to get delay, but the accuracy is poor, almost 1ms, that is the tick of the linux system. So 1us can not be got by sleep() Cycle conter has a much high accuracy, that is the 1/CPU_freq. But the problem is that if "WFI" was used, for example,  the idle task may use that instruction in some RTOS, the CPU will suspend, that is the cycle conter was supend.  If "WFI" instruction was not used in Linux, cycle counter is a good way to delay 1us. I think some system API can be called to do that.
Reply
  • Note: This was originally posted on 11th May 2011 at http://forums.arm.com

    sleep() can be used to get delay, but the accuracy is poor, almost 1ms, that is the tick of the linux system. So 1us can not be got by sleep() Cycle conter has a much high accuracy, that is the 1/CPU_freq. But the problem is that if "WFI" was used, for example,  the idle task may use that instruction in some RTOS, the CPU will suspend, that is the cycle conter was supend.  If "WFI" instruction was not used in Linux, cycle counter is a good way to delay 1us. I think some system API can be called to do that.
Children
No data