[U-Boot-Users] TFTP times out?
Martin Krause
Martin.Krause at tqs.de
Fri Nov 11 09:49:46 CET 2005
Hie Zhen,
Zhen Wang wrote on Friday, November 11, 2005 7:18 AM:
> CFG_HZ is a configuration _SETTING_ in my board's configuration
> header file(I don't know its exact function till now). TIMEOUT and
CFG_HZ defines the number of timer ticks per second. The function
get_timer() returns the current vaule of the internal timer tick
counter (with the variable name: 'timestamp'). The following code
snippet should delay for exat one second:
...
tmo = get_timer(0) + 1 * CFG_HZ;
while (get_timer(0) < tmo);
> TIMEOUT_COUNT both are constants defined in net/tftp.c.
> I've got a 2130KB(i.e. 4260 TFTP packages) uClinux zImage to
> download
> over the twisted cable which connected my board with my PC directly.
> The numbers in last column of above table indicate the last TFTP
> block id received from the TFTP server(PC) before giving up(i.e. retry
> count beyonds TIMEOUT_COUNT). Therefore 4260 indicates a complete
> download. According to the table, TIMEOUT doesn't seem to be a
> critical part in
> unsuccessful downloads. Though I can use a large TIMEOUT_COUNT to
> accomplish the download, it's a bad solution. Now my first suspicion
> is
> that the timing without interrupts scheme implemented in
> cpu/s3c44b0/interrupts.c.
There actually seems to be a bug. CFG_HZ is set to 1000 on your board.
This means in one second the counter returned by get_timer() should
increase by 1000. But this doesn't correspond to the implementation
of udelay() on your board (from cpu/s3c44b0/interrupts.c):
void udelay (unsigned long usec)
{
ulong tmo;
tmo = usec / 1000;
tmo *= CFG_HZ;
tmo /= 8;
tmo += get_timer (0);
while (get_timer_masked () < tmo)
/*NOP*/;
}
This assumes that the internal counter increases by 8 in one second.
Since CFG_HZ should be 1000 (according to Wolfgang Denk) I suggest
to fix the TIMER_LOAD_VAL on your board, so that one underrun
of timer TCNT01 accours every 1 ms.
Regards,
Martin
More information about the U-Boot
mailing list