Forum Discussion
Altera_Forum
Honored Contributor
13 years agoNIOS II timer problem
Hi, I've got a problem with my program running on DE2 board from altera (Nios II processor) Our task was to construct a model of a washing machine, and allow user to choose the speed of spin. In a...
Altera_Forum
Honored Contributor
13 years agoI just wrote a small test program, and using alt_nticks works perfectly in this program:
#include "sys/alt_alarm.h"
# include "sys/alt_timestamp.h"
static alt_alarm my_alarm;
static alt_u32 ticks_per_250ms;
static volatile unsigned char callback_called;
alt_u32 alarm_callback(void* context){
callback_called = 1;
return ticks_per_250ms;
}
int main(void){
ticks_per_250ms = alt_ticks_per_second() / 4;
callback_called = 0;
alt_alarm_start(&my_alarm, ticks_per_250ms, alarm_callback, NULL);
int current_ticks = 0;
while(1){
current_ticks = alt_nticks();
}
}
So it seems, that it can run with interrupts enabled and in normal program code. But I have another, bigger project, which also uses the lwIP stack and FreeRTOS, and in this project, alt_nticks() returns zero all the time. This drives me crazy... the BSP is exactly the same for both projects and I did not call any FreeRTOS or lwip specific code before making the call to alt_nticks() (btw: in my freeRTOS project, the alt_alarm doesn't work either for some kind of reason... maybe this is related to the alt_nticks problem?) regards *edit*: btw, I was using a hardware design provided by my board manufacturer (DE2-115 board and the rgmii-enet0 webserver hardware config)