Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Timer problem (uS)

Altera_Forum
Honored Contributor II
1,374 Views

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?

0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
319 Views

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?
0 Kudos
Altera_Forum
Honored Contributor II
319 Views

I need both periodic interrupt and timestamp. I have tried to use sopc-builders timer component configuring it with 1 uS resolution but still managed to get it running only 1 mS resolution.

0 Kudos
Altera_Forum
Honored Contributor II
319 Views

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&#39;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&#39;re trying to do and how you&#39;re trying to do it. (code snippets would help!) 

 

Cheers, 

 

- slacker
0 Kudos
Reply