Using MOD54415 out of the box.
Running this simple program and output is almost 30 seconds instead of expected 10. Any ideas why?
void UserMain(void * pd) {
InitializeStack();
if (EthernetIP == 0) GetDHCPAddress();
OSChangePrio(MAIN_PRIO);
EnableAutoUpdate();
iprintf("Application started\n");
int ten_seconds_counter = 0;
while (1) {
OSTimeDly(TICKS_PER_SECOND);
if (++ten_seconds_counter==10) {
ten_seconds_counter = 0;
iprintf("Ticks=%d, Secs=%d, TPS=%d\r\n", TimeTick, Secs, TICKS_PER_SECOND);
}
}
}
OUTPUT:
Application started
Ticks=500, Secs=10, TPS=50
Ticks=1000, Secs=20, TPS=50
Ticks=1500, Secs=30, TPS=50............
Clock, TICKS_PER_SECOND, etc VERY Slow
Re: Clock, TICKS_PER_SECOND, etc VERY Slow
Because TICKS_PER_SECOND should be 20.... That's what the system timer is compiled with. Did you change the value in constants.h?
Basically, your TICKS_PER_SECOND is 2.5 times larger than the one the OS is compiled with, causing your code to delay 2.5 times longer.
-Dan
Basically, your TICKS_PER_SECOND is 2.5 times larger than the one the OS is compiled with, causing your code to delay 2.5 times longer.
-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: Clock, TICKS_PER_SECOND, etc VERY Slow
Thanks Dan, I'm sure that's it. I did do compile system files afetr changing the TPS to 50, guess I missed something will try again.
Bob H.
Bob H.
Re: Clock, TICKS_PER_SECOND, etc VERY Slow
You have to recompile the MOD5441X system files as well, not just the nburn\system....
The earliest version of MOD5441X/system/bsp.c did not adjust the ticks, ie they were fixed and ignored the TICKS_PER_SECOND
So make sure your running recent code....
I have that file at rev 1.5.....
AQlso
From constants.h...
/*
PLEASE READ THIS BEFORE MODIFYING TICKS_PER_SECOND
Before you change this value understand what changing it does.
Making it faster only slows things down. It does not speed up task switches,
If only changes the granularity of timedlays and timeouts.
Task switches happen much much fater than the tick interval. They happen as
soon as one task blocks or an interrupt /or task causes a higher priority task
to be unblocked. The Time tick has NOTHING to do with task switches.
If you change it to the maximum 200 you have increased the RTOS overhead by a factor
of 10 and have actually slowed your system.
*/
The earliest version of MOD5441X/system/bsp.c did not adjust the ticks, ie they were fixed and ignored the TICKS_PER_SECOND
So make sure your running recent code....
I have that file at rev 1.5.....
AQlso
From constants.h...
/*
PLEASE READ THIS BEFORE MODIFYING TICKS_PER_SECOND
Before you change this value understand what changing it does.
Making it faster only slows things down. It does not speed up task switches,
If only changes the granularity of timedlays and timeouts.
Task switches happen much much fater than the tick interval. They happen as
soon as one task blocks or an interrupt /or task causes a higher priority task
to be unblocked. The Time tick has NOTHING to do with task switches.
If you change it to the maximum 200 you have increased the RTOS overhead by a factor
of 10 and have actually slowed your system.
*/