[U-Boot] common/xyzmodem.c, ymodem, slow behavior receiving bytes

Angelo Dureghello sysamfw at gmail.com
Sat Nov 10 14:40:08 CET 2012


Dear all,

i am experiencing a strange behavior on the u-boot ymodem protocol.
I am running u-boot, (pulled from origin/head yesterday) on a mcf5307 based 
board. I am currently working to include this board/cpu as supported into 
u-boot.

cpu runs at 90Mhz (bus clock at 45), baud rate 115200.

On an older u-boot (2011.09.00122), i was able to upload files through ymodem 
at 115200 without any issue.

Once pulled yesterday head, and installed on the board, i am no more able to
upload files. U-boot times out when the first 128 bytes block is sent, and
sends SYN (C) again, so i started some debugging on xyzmodem.c:

Protocol times-out here, from line 434

  ....
  xyz.len = (c == SOH) ? 128 : 1024;
  xyz.bufp = xyz.pkt;
  for (i = 0; i < xyz.len; i++)
    {
      res = CYGACC_COMM_IF_GETC_TIMEOUT (*xyz.__chan, &c);
      ZM_DEBUG (zm_save (c));
      if (res)
	{
	  xyz.pkt[i] = c;
	}
      else
	{
	  ZM_DEBUG (zm_dump (__LINE__));
---->>    return xyzModem_timeout;
	}
    }


Echoing received char back to PC, i see about 1 every 3 received chars seems 
lost somewhere, so the first 128bytes block is never completely received 
(time out).

I measured baudrate through oscilloscope, 
from PC to u-boot board, i have 115600
from u-boot board to PC, i have 117180 (still inside 2% tolerance)

Also verified timer/delay functions works properly in new u-boot build.
As clients i used minicom and other, and have the same result.

So from a first look, seems the receive routine from line 434 is no more fast 
enough to receive the whole block. I moved speed down to 57600, upload works 
fine again.

What do you think about ?

Best Regards,
Angelo Dureghello


More information about the U-Boot mailing list