Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12452 Discussions

alt_timestamp returns the same value

Altera_Forum
Honored Contributor II
1,106 Views

Hello, I'm trying below: 

int main() 

alt_u32 t1; 

alt_u32 t2; 

alt_u32 t3; 

 

int ret = alt_timestamp_start(); 

t1 = alt_timestamp(); 

usleep(1000000); 

t2 = alt_timestamp(); 

t3 = alt_timestamp_freq(); 

 

return 0; 

 

ret is 0, t3 is 50000000(the input clock of Interval Timer object), 

but t1 and t2 always show 4209704959. 

It seems that the Timer is not ticking. 

I also tried alt_nticks which always returned 0; 

I wonder what might be the problem here. 

 

-Cyclone V Dev Board 

-QuartusII 15.0(64bit), Qsys on Win7 

-NiosI 15.0 Software Build Tools for Eclipse 

 

Thanks in advance.
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
170 Views

could you try to place the usleep with some for loop delay just to isolate this is time stamp feature nor working first?

Altera_Forum
Honored Contributor II
170 Views

Thank you pororo, 

I tried below but still not working: 

int main() 

alt_u32 t1; 

alt_u32 t2; 

alt_u32 t3; 

unsigned int i; 

 

int ret = alt_timestamp_start(); 

t1 = alt_timestamp(); 

for(i=0; i<0x00ffffff; i++) IORD(ONCHIP_MEMORY2_1_BASE,0); 

t2 = alt_timestamp(); 

t3 = alt_timestamp_freq(); 

 

return 0; 

 

I still get 4209704959 for both t1 and t2. 

I had never faced this problem when I was using 

Cyclone IV Development or Custom boards with 

QuartusII, SOPC Builder & NiosII 11.0sp1. 

I wonder what I am missing..
Altera_Forum
Honored Contributor II
170 Views

Sorry, 

It seems that my problem was not connecting data_master of NiosII and slave of Interval Timer in Qsys. 

Instead, I was connecting instruction_master. 

Thanks!
Altera_Forum
Honored Contributor II
170 Views

 

--- Quote Start ---  

Sorry, 

It seems that my problem was not connecting data_master of NiosII and slave of Interval Timer in Qsys. 

Instead, I was connecting instruction_master. 

Thanks! 

--- Quote End ---  

 

 

good to hear that!!!
Reply