Forum Discussion
ZKhan1
Occasional Contributor
7 years agoNios-ll Interval Timer is not enabled
Hi there , I have been trying to run Nios-ll interval timer using the code given in Embedded IP core document the code gets stuck at ""No timestamp device available\n". I did included Interval Time...
dsmirnov
Occasional Contributor
7 years agoI guess the problem is that you declared this timer as system.
Let us first check the alt_timestamp_start function:
int alt_timestamp_start(void)
{
void* base = altera_avalon_timer_ts_base;
if (!altera_avalon_timer_ts_freq)
{
return -1;
}
else
{
. . .
}That means that you get the zero value of altera_avalon_timer_ts_freq. But why? As we can find in the altera_avalon_timer.h there is a definition for timer initialization, which is basicly looks like this:
#define ALTERA_AVALON_TIMER_INIT(name, dev)
if (name##_BASE == ALT_SYS_CLK_BASE)
{
. . .
. . .
else if (name##_BASE == ALT_TIMESTAMP_CLK_BASE)
{
if (name##_SNAPSHOT)
{
altera_avalon_timer_ts_base = (void*) name##_BASE;
altera_avalon_timer_ts_freq = name##_FREQ;
}
. . .
}The value of altera_avalon_timer_ts_freq is getting right frequency is only when during the definition we don't have a sys_clk. Since you have it, we don't visit the else branch and we don't initialize it.
You can don't use it as a sys_clk, or create new interval timer.