U-boot over nc/netcat/socat/ethernet drops characters. How to fix?

Hi all.

If I run printenv (from the u-boot/porta-danube prompt) while connected via a serial cable, I get the expected result:

Porta-Danube # printenv
ipaddr=192.168.1.11
serverip=192.168.1.10
ncip=192.168.1.10
netmask=255.255.255.0
ethaddr=00:01:22:33:44:55
netdev=eth0
u-bootfile=u-boot.bin
update_uboot=tftpboot 80500000 $(u-bootfile);erase $(f_uboot_addr) $(f_uboot_end);cp.b 80500000 $(f_uboot_addr) $(filesize);cmp.b 80500000 $(f_uboot_addr) $(filesize) 
f_uboot_addr=0xb0000000
f_uboot_end=0xb003ffff
bootcmd=run nboot
silent=0
nboot=nand read 0x81000000 0x004000 0xe50000; bootm 0x81000000
bootdelay=5
preboot=setenv stdin nc; setenv stdout serial; setenv stderr serial
baudrate=115200
stderr=nc
stdin=serial
stdout=serial

Environment size: 580/65532 bytes

If, instead, I run the same command while connected via an ethernet cable, I get a (variable) unexpected result:

Porta-Danube # printenv
printenv
ipaddr=92.1681.1serverip=192.1681.10ncip=192.1681.10netmask=255.255.255.0ethaddr=00:0:22:3344:5netdev=th0u-bootf
ie=u-bot.binupdate_ubot=ttpboot 80500000$(u-botfie);erase $(f_uboot_add) $(f_uboot_end);cpb 8050000 $(f_uboot_ad
r)$(filesize);cmp.b 80500000$(f_uboot_ddr) $(filsize) f_uboot_addr=0xb0000000f_uboot_end=0b003fffbootcm=ru nboot
silent=0nboot=nad read 0x80000000x004000 0xe50000; ootm 081000000bootdela=5
preboot=etenv stdin nc; setenvstdout serial; setev stderr srialbaudrate=115200stdin=ncstder=seria
stdout=nc
Environment size: 576/65532 bytes

or

Porta-Danube # printenv
ipaddr=192.168.1.11servrip=192.168.1.10ncip=192.168.110netask=255.255.2550ethadr=00:1:2:33:44:55nedev=eth0u-boot
file=u-boot.binupdate_ubot=tftpoot 80500000 $(u-botfile)erae $(f_boo_addr)$(fuboot_nd);cp.b 80500000 $f_uboo_add
r) $(filesize);mp.b 8050000 $(f_uboot_addr) $(flesize) f_uboot_addr=xb000000f_uboot_end=xb03ffffbootcmd=run boo
silent=0nboot=nand ead0x81000000x004000 0xe5000; boom 0xodela tdiv sdstenvbaurtderrstdo

i.e. if I am connected via an ethernet cable (instead of a serial cable), the returned result (uboot's stdout) appears to drop characters.

I've already seen the uboot article entitled "Why is my Ethernet operation not reliable" and I've already used ethtool to change the autonegotiation parameter, the duplex parameter and the speed parameter of my ethernet connection, and I've also tried using socat instead of netcat as the fake udp terminal emulator, but so far nothing has helped.

Two questions: does anyone else get this problem, and does anyone know how to fix it?

Many thanks, J

I have no experience with "uboot over ethernet"... having said that.....

This type of behaviour is seen when there is ad-hoc/inconsistent serial reads.

Either the chars are simply not there.... or the program that reads them has inadequate timing / logic to "chunk handle" what is available and when.

In other words.... using udp and ethernet is not conducive to the read timing. If it is not random loss... ( predictable sequencing ) then encoding would come into play.

1 Like