Forum Discussion
Altera_Forum
Honored Contributor
13 years ago --- Quote Start --- I have an Interval Timer existing and connected in my NIOS II processor and floating point custom instructions, also I have sys_clk_timer set in the BSP editor, but this code outputs NaN. If I just output T2 and T1, I always only get 1 respectively. --- Quote End --- I think you're getting NaN because your expression evaluates to 0/0 which means that alt_ticks_per_second() is returning '0', as well as times() returning '1'. So.... it sounds like you've got a problem with either your Qsys system not hooked up right or with your BSP. Is it something simple like your BSP compile out of date or you're using the wrong copy of it, etc. etc. etc. ? Your generated system.h should have macros for ALT_SYS_CLK that points to a timer which has a corresponding "_TICKS_PER_SEC" macro associated with it with a non-zero value in it. The alt_nticks_per_second() returning zero should be pretty easy to step through and figure out why. The code is in your BSP HAL/inc/sys/alt_alarm.h, see how alt_sysclk_init() is being called, if at all. As a sanity check, your code runs fine on my BSP + HW.