For a new test, we have declared the second timer in SOPC builder in customer mode with writable/readable period, writable/readable control and writable/readable snap.
This timer works fine if it is declared as system clock timer otherwise it doesn’t work. We also try to read the timer period and the snap value, in the both case the read values was wrong (-1).
(Before the snap reading we make a snap writing to update the values on the registers, like it is explained in the timer datasheet)
example of our code :
// declaration of the 250ms timer IOWR_ALTERA_AVALON_TIMER_PERIODL(TIMER_250M_IRQ, 0x0900);
IOWR_ALTERA_AVALON_TIMER_PERIODH(TIMER_250M_IRQ, 0x003D);
alt_irq_enable(TIMER_250M_IRQ);
IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_250M_IRQ, ALTERA_AVALON_TIMER_CONTROL_CONT_MSK | ALTERA_AVALON_TIMER_CONTROL_START_MSK | ALTERA_AVALON_TIMER_CONTROL_ITO_MSK);
alt_irq_register( TIMER_250M_IRQ, NULL, TIMER250M_IRQ);
// reading of the programmable period periodl=IORD(TIMER_250M_IRQ, ALTERA_AVALON_TIMER_PERIODL_REG);
periodh=IORD(TIMER_250M_IRQ, ALTERA_AVALON_TIMER_PERIODH_REG);
// reading with the snapshot (writing and then reading) IOWR_ALTERA_AVALON_TIMER_SNAPL(TIMER_250M_IRQ, 0x00);
IOWR_ALTERA_AVALON_TIMER_SNAPH(TIMER_250M_IRQ, 0x00);
periodl=IORD_ALTERA_AVALON_TIMER_SNAPL(TIMER_250M_IRQ);
periodh=IORD_ALTERA_AVALON_TIMER_SNAPH(TIMER_250M_IRQ);
At this moment, we develop a new solution with a single timer. In this timer, we use a counter to have the second timer period.
We think that we give up the solution with 2 timers.
Thank you Cris72 for your help.