Hello,
I am trying to generate delay in CPU. For instance after writing a register, I want to read it again after 1000ns. What should be the C code or the assembly code for the same?
Thank you
Nishank Bansal
What's the processor and how precise does the timing need to be?
Hello Martin,
The processor is A72. I need to generate delay of around 1000ns and 20000ns.
Martin Weidmann said:how precise does the timing need to be?
MNB said:around 1000ns and 20000ns
That doesn't really answer the question!
BTW: It gets as bit hard to count all those zeros - "1us" and "20us" would be clearer.
And quicker for you to type!
What exactly do you mean by precision? Does it mean precision in percentage or if I am trying to have a delay of 1us and delay generated is 1us±precision? If not, it would be very helpful if you can explain with some example. I am new to the industry. So please bare with me :)
Do you need delays in us granularity or 100ns, 10ns or even 1ns.
Anyway Cortex-A system have a system timer. And SoCs have also timers.
So I suggest to pick one that runs fast enough for the precision you need, set it up for free running. The rest is common program techniques.
Hello Bastian,
Granularity of 10ns would be fine. I will explore the timer thing you are telling.
Thanks :)
The blank line illustrates that the function printed to my standard output, and I had to hit Enter to ensure I was on a prompt.
The upside of this method is that while the Timer thread was waiting, I was able to do other things, in this case, hitting Enter one time - before the function executed (see the first empty prompt).
There isn't a respective object in the multiprocessing library. You can create one, but it probably doesn't exist for a reason. A sub-thread makes a lot more sense for a simple timer than a whole new subprocess.
upsers
For short delays (on the order of microseconds), you can use some Keil extensions to insert NOP instructions into your code.For slightly longer delays, you'll probably want to use a timer to measure the delay.For even longer delays, where you don't want to tie up the processor while waiting myaarpmedicare, you'll need a timer tick interrupt and some sort of software timer queue structure. The timer interrupt will signal the occurrence of an event (however that is to be done in your system) and set up the timer for the next event.