• 0
Sign in to follow this  
smit

Measuring time using a Zynq Processor

Question

I am working on the Zybo Z7-10 board. My goal is to determine the position and orientation of the FPGA in space at any given instance. For that, I am using a PmodACL2 and PmodGYRO. Now, I need to integrate the accelerations and angular velocities. How do I measure the time at which the Pmods are giving me the data?

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

@smit,

The first question that spring to mind is this: do you want to measure absolute or relative time? Relative time would certainly be easier and is usually sufficient. One way to do this would be to have a free-running counter in the logic. A 64-bit counter clocked at 100 MHz would provide 10 ns resolution ( not precision or accuracy ) for a very long time before you'd have to be concerned with wrap-around issues. Whenever an event occurs you could save the value of the free-running counter to a register as a "timestamp". Of course the logic gets a bit more complicated if you want to save time deltas between events for multiple event domains. I do this all the time as part of normal debug data capture to measure performance criteria for most of my designs. I'd suggest that you create logic to do most of the work and make the processor's chore as simple as possible. You'd just need to provide the ARM a way to read registers in the PL.

Absolute time gets a bit more complicated, especially if you need a very high degree of precision.

Share this post


Link to post
Share on other sites
  • 0

Hi @smit,

For measurement time intervals with very high precision ARM processor has so called private timer described in the document UG585-Zynq-7000-TRM. Its primary clock frequency is 1/2 of the processor clock frequency. It is possible to add prescalar if this is too high for your application. Xilinx also provides a driver and C-code for the example with Vivado/SDK in the \embeddedsw\XilinxProcessorIPLib\drivers\scutimer

It was very useful for benchmarking of my project and some data transfer operations.

For real time clock I've tested Pmod-RTC. This one provides timestamps including actual HH:mm:ss, day and year. The problem is the it counts and reports time with 1 sec precision only.

 

 

Share this post


Link to post
Share on other sites
  • 0

@Notarobot,

I've got no disagreement with your advice. B-u-t, ( isn't there always a but in technical guidance? ) I'll point out that once you build your first Verilog or VHDL time measuring modules/components and verified that they work as designed you will have a more adaptable and capable plug-in to any FPGA design. I haven't had many instances where 10 ns resolution wasn't overkill as far as that goes. Admittedly, I have a preference for doing things in hardware (logic), especially when it simplifies or eliminates software design, and particularly if it eliminates interrupts or task management.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this