I need high resolution timer and I've configured timer to use uS resolution at SOPC Builder. When I call function alt_ticks_per_second() it shows 1000000 as expected but still the timer is running only in mS resolution. Is there anything I can do with this?
链接已复制
3 回复数
Well, if all you need is a high-resolution timestamp, I've got a component that does that (nanosecond resolution). If you need a simple periodic interrupt, the Nios Timer component can do that, too, but you have to set it up in the SOPC Builder.
Is one of these what you're looking for, or do you need something else?Hassu,
Almost every design example contains examples of a sys_clk_timer in use. The HAL automatically configures it for a system clock tick of 10ms. This is used, directly, by uC/OS-II, if you are using that RTOS, and, likely, others. For a software example, using a "high_res"/timestamp timer, look no further than the dhrystone software template. You'll find the hardware and software examples in the <nios2_install_dir>/examples directory. Regarding changing the default settings, you can read up on how to do that in the "Altera Embedded Peripherals Handbook" in the documents directory (n2cpu_nii5v3.pdf). If, after browsing through all of that, you still have questions, then please post some more detail of exactly what you're trying to do and how you're trying to do it. (code snippets would help!) Cheers, - slacker