Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

alt_timestamp returns the same value

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.

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- 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!!!