Altera_Forum
Honored Contributor
15 years agoNios instability
Hello,
I'm using nios II processor with a high_res_timer for different test before continuing my project. The test i'm trying to do is to generate on a pin a square frequency with a 400µs period. For that, I have a cyclone III development board with a Nios II/s CPU (clk_50Mhz) and a timer "high_res_timer" (clk_250MHz full featured with a Timeout period of 1s) and all others components I need to run the system. In Nios II IDE, I change a hello world project en select the the "high_res_timer" as timestamp timer and type the following code : #include <altera_avalon_pio_regs.h> #include <sys/alt_timestamp.h> int main() { while(1) { alt_timestamp_start(); while(alt_timestamp() < 50000) { IOWR_ALTERA_AVALON_PIO_DATA(SIGNAL, 0x00); } while((alt_timestamp() > 49999) && (alt_timestamp() < 100000)) { IOWR_ALTERA_AVALON_PIO_DATA(SIGNAL, 0x01); } } return 0; } after that, i check the signal with a scope, but the period isn't stable any idea how to solve that ? thanks in advance