gpt4 book ai didi

linux - uboot tftpboot总是超时(使用DM9000A网卡)

转载 作者:太空宇宙 更新时间:2023-11-04 03:48:44 25 4
gpt4 key购买 nike

我使用uboot,并在其中添加了tftpboot命令。但是效果不太好,虽然可以传输数据,但在整个传输过程中总是出现超时。控制台显示如下

我的以太网拓扑是:带有uboot的板连接到我的路由器,我的PC连接到路由器。我的tftp服务器位于我PC的VM linux上,并且VM使用桥接模式连接到以太网

当然,我尝试将我的板直接连接到 PC,但问题仍然存在

我修改了dm9000x.c第433行,更改

tmo = get_timer(0) + 5 * CONFIG_SYS_HZ; //

进入

tmo = get_timer(0) + 200; //timeout 200 miliiseconds

翻译时间现在可以忍受了。但仍然出现多次传输超时,日志如下

dm9000 i/o: 0x88000000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 1a:2a:3a:4a:5a:6a
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.0.15; our IP address is 192.168.0.12
Filename '/linux-3.14.24/fs/yaffs2/ubifs.img'.
Load address: 0x20000000
Loading: ################################################################transmission timeout
#
####transmission timeout
#############################################################
####################transmission timeout
##########transmission timeout
################transmission timeout
##################transmission timeout
#
#################################################################
#################################################################
#############################################################transmission timeout
####
#####################transmission timeout
######################transmission timeout
######################
#################################################################
###############################################################transmission timeout
##
##################################transmission timeout
#######transmission timeout
########################
#################################################################
#################################################################
#################################################################
###################transmission timeout
###################
61.5 KiB/s
done
Bytes transferred = 4515840 (44e800 hex)
4515840 bytes written to volume rootfs

我还是不知道为什么,因为它实际上可以传输数据。那么对此有什么想法吗?

最佳答案

我检查了我的 u-boot dm9000 驱动程序并发现了这个

static int dm9000_send(struct eth_device *netdev, void *packet, int length)
{
int tmo;
struct board_info *db = &dm9000_info;

DM9000_DMP_PACKET(__func__ , packet, length);

DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */

/* Move data to DM9000 TX RAM */
DM9000_outb(DM9000_MWCMD, DM9000_IO); /* Prepare for TX-data */

/* push the data to the TX-fifo */
(db->outblk)(packet, length);

/* Set TX length to DM9000 */
DM9000_iow(DM9000_TXPLL, length & 0xff);
DM9000_iow(DM9000_TXPLH, (length >> 8) & 0xff);

/* Issue TX polling command */
DM9000_iow(DM9000_TCR, TCR_TXREQ); /* Cleared after TX complete */

/* wait for end of transmission */
tmo = get_timer(0) + 10 * CONFIG_SYS_HZ;
while ( !(DM9000_ior(DM9000_NSR) & (NSR_TX1END | NSR_TX2END)) ||
!(DM9000_ior(DM9000_ISR) & IMR_PTM) ) {
if (get_timer(0) >= tmo) {
printf("NSR is 0x%x, ISR is 0x%x\n",DM9000_ior(DM9000_NSR),DM9000_ior(DM9000_ISR)); // this line is for debug use
printf("transmission timeout\n");
break;
}
}

DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */

DM9000_DBG("transmit done\n\n");
return 0;
}

当发生超时时,

printf("NSR is 0x%x, ISR is 0x%x\n",DM9000_ior(DM9000_NSR),DM9000_ior(DM9000_ISR)); // this line is for debug use

这一行表明DM9000_ISR的第二位永远不会设置为1。我不知道为什么所以我改变了这样的代码

static int dm9000_send(struct eth_device *netdev, void *packet, int length)
{
int tmo;
struct board_info *db = &dm9000_info;

DM9000_DMP_PACKET(__func__ , packet, length);

DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */

/* Move data to DM9000 TX RAM */
DM9000_outb(DM9000_MWCMD, DM9000_IO); /* Prepare for TX-data */

/* push the data to the TX-fifo */
(db->outblk)(packet, length);

/* Set TX length to DM9000 */
DM9000_iow(DM9000_TXPLL, length & 0xff);
DM9000_iow(DM9000_TXPLH, (length >> 8) & 0xff);

/* Issue TX polling command */
DM9000_iow(DM9000_TCR, TCR_TXREQ); /* Cleared after TX complete */

/* wait for end of transmission */
tmo = get_timer(0) + 10 * CONFIG_SYS_HZ;

while (DM9000_ior(DM9000_TCR) &TCR_TXREQ) {
if (get_timer(0) >= tmo) {
printf("transmission timeout\n");
break;
}
}

DM9000_iow(DM9000_ISR, IMR_PTM); /* Clear Tx bit in ISR */

DM9000_DBG("transmit done\n\n");
return 0;
}

现在,一切都OK了。但我仍然对为什么 DM9000_ISR 的第二位出错感到困惑。是DM9000硬件BUG吗?

关于linux - uboot tftpboot总是超时(使用DM9000A网卡),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27086432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com