完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
移植了发烧友的LWIP程序,出现ENC28J60接收出现接收错误中断标志位为1,一直打印Receive error! Receives a packet number:68Receive error! Receives a packet number:67
Receive error! Receives a packet number:66 Receive error! Receives a packet number:65 Receive error! Receives a packet number:64 Receive error! Receives a packet number:63 Receive error! Receives a packet number:62 Receive error! Receives a packet number:61 Receive error! Receives a packet number:60 Receive error! Receives a packet number:0 Receive error! Receives a packet number:0 Receive error! Receives a packet number:0 Receive error! Receives a packet number:0 Receive error! Receives a packet number:0 Receive error! Receives a packet number:0 Receive error! Receives a packet number:0 Receive error! Receives a packet number:0 Receive error! Receives a packet number:0 Receive error! Receives a packet number:0 接着就连不上网页了。请教大神这个问题怎么解决! |
|
相关推荐
10个回答
|
|
有没有其他网友碰到类似的情况!
|
|
|
|
|
|
我也出现这个问题,不知道楼主解决没有?
|
|
|
|
我现在也出现这个问题,楼主有解决吗?
|
|
|
|
没有真正意义上的解决的,在有接收错误中断标志位后就复位程序的,你有解决的方法吗?
|
|
|
|
以太网是很复杂的外设,即使底层驱动部分也涉及相当多的要点,stm的默认驱动配置,直接用问题很多的,特别是老版的,出现你的这种情况有很多,不过如果你的ETH_RXBUFNB定义为6的话,我倒是可以解释为什么是这种堵塞卡死的情况,不过我还是建议你去详细追下底层的代码, 挺重要的。另外下面是我调试的配置,经过产品检验工作正常的。
|
|
|
|
[C] 纯文本查看 复制代码
void ETH_MACDMA_Config(void){ ETH_InitTypeDef ETH_InitStructure; /* Enable ETHERNET clock */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_ETH_MAC | RCC_AHB1Periph_ETH_MAC_Tx | RCC_AHB1Periph_ETH_MAC_Rx, ENABLE); /* Reset ETHERNET on AHB Bus */ ETH_DeInit(); /* Software reset */ ETH_SoftwareReset(); /* Wait for software reset */ while (ETH_GetSoftwareResetStatus() == SET); /* ETHERNET Configuration---------------------------------------------*/ /* Call ETH_StructInit if you don't like to configure all ETH_InitStructure parameter */ ETH_StructInit(Ð_InitStructure); /* Fill ETH_InitStructure parametrs */ /*------------------------ ETH_MACCR-----------------------------------*/ ETH_InitStructure.ETH_AutoNegotiation = ETH_AutoNegotiation_Disable; //参数由用户配置,选择disable需要自动配置默写参数 ETH_InitStructure.ETH_Watchdog = ETH_Watchdog_Disable; //关闭看门狗定时器,允许接收超长帧 ETH_InitStructure.ETH_Jabber = ETH_Jabber_Disable; //关闭jabber定时器,允许发送超长帧 ETH_InitStructure.ETH_InterFrameGap = ETH_InterFrameGap_96Bit; //发送帧间间隙,12.17 ETH_InitStructure.ETH_Speed = ETH_Speed_100M; //快速以太网速度 ETH_InitStructure.ETH_LoopbackMode = ETH_LoopbackMode_Disable; //不启用自循环模式 ETH_InitStructure.ETH_Mode = ETH_Mode_FullDuplex; //全双工模式 /*自动填充/CRC剥离处理不执行,转发所有帧*/ ETH_InitStructure.ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable; /*------------------------ ETH_MACFFR----------------------------------*/ ETH_InitStructure.ETH_ReceiveAll = ETH_ReceiveAll_Disable; //MAC过滤只接受通过源目的地址的数据 ETH_InitStructure.ETH_SourceAddrFilter = ETH_SourceAddrFilter_Normal_Enable; //MAC过滤源地址错误帧? ETH_InitStructure.ETH_PassControlFrames = ETH_PassControlFrames_BlockAll; //MAC不转发任何控制帧 ETH_InitStructure.ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Enable; //接收广播帧 ETH_InitStructure.ETH_DestinationAddrFilter = ETH_DestinationAddrFilter_Normal; //目的地址过滤结果正常 ETH_InitStructure.ETH_PromiscuousMode = ETH_PromiscuousMode_Disable; //混杂模式,启用帧过滤 ETH_InitStructure.ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect; //过滤器正常工作,不传送控制帧 ETH_InitStructure.ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect; //单播帧目的地址完美过滤 /*------------------------ DMA ETH_DMAOMR -----------------------------------*/ /* When we use the Checksum offload feature, we need to enable the Store and Forward mode: the store and forward guarantee that a whole frame is stored in the FIFO, so the MAC can insert/verify the checksum, if the checksum is OK the DMA can handle the frame otherwise the frame is dropped */ /*丢弃校验错误帧不执行(因为未进行硬件校验)*/ ETH_InitStructure.ETH_DropTCPIPChecksumErrorFrame = ETH_DropTCPIPChecksumErrorFrame_Disable; ETH_InitStructure.ETH_ReceiveStoreForward = ETH_ReceiveStoreForward_Disable; //接收数据超过阈值转发(开启时传输一半出现错误帧会导致FIFO被占用,导致卡顿, 关闭后速度会下降) ETH_InitStructure.ETH_FlushReceivedFrame = ETH_FlushReceivedFrame_Enable; //描述符被占用和接收FIFO不可用时清空FIFO(小概率引起丢帧,但可以解决FIFO溢出) ETH_InitStructure.ETH_TransmitStoreForward = ETH_TransmitStoreForward_Enable; //发送帧转发 12.17 ETH_InitStructure.ETH_TransmitThresholdControl = ETH_TransmitThresholdControl_128Bytes; //发送阈值为128Bytes 12.17 ETH_InitStructure.ETH_ForwardErrorFrames = ETH_ForwardErrorFrames_Disable; //MAC会提交错误帧(关闭) /*接收FIFO丢弃所有小于64字节的帧*/ ETH_InitStructure.ETH_ForwardUndersizedGoodFrames = ETH_ForwardUndersizedGoodFrames_Disable; ETH_InitStructure.ETH_ReceiveThresholdControl = ETH_ReceiveThresholdControl_64Bytes; //接收阈值为64Bytes ETH_InitStructure.ETH_SecondFrameOperate = ETH_SecondFrameOperate_Disable; //DMA直接发送第二个帧,不需要之前帧回复 /*------------------------ DMA ETH_DMABMR -----------------------------------*/ ETH_InitStructure.ETH_AddressAlignedBeats = ETH_AddressAlignedBeats_Enable; //传输地址对齐 ETH_InitStructure.ETH_FixedBurst = ETH_FixedBurst_Enable; //固定的突发 ETH_InitStructure.ETH_RxDMABurstLength = ETH_RxDMABurstLength_32Beat; ETH_InitStructure.ETH_TxDMABurstLength = ETH_TxDMABurstLength_32Beat; ETH_InitStructure.ETH_DMAArbitration = ETH_DMAArbitration_RoundRobin_RxTx_1_1; //发送和接收比例(上传数据时重要) 1:1 /* Configure Ethernet */ ETH_Init(Ð_InitStructure, DP83848_PHY_ADDRESS); /* Enable the Ethernet Rx-Tx Interrupt*/ ETH_DMAITConfig(ETH_DMA_IT_NIS | ETH_DMA_IT_R | ETH_DMA_IT_T , ENABLE);} |
|
|
|
ENC28J60勘误表,好像芯片有问题,通过程序避免。我回去找找例程
unsigned int enc28j60PacketReceive(unsigned int maxlen, unsigned char* packet) { unsigned int rxstat;//接收状态 unsigned int len; //接收长度 //如果检查到一个包被接收并且缓存 if(!(enc28j60Read(EIR) & EIR_PKTIF)) { //勘误表#6,PKTIF是不可靠的,双重检查【PKTIF】和【EPKTCNT】 if(enc28j60Read(EPKTCNT) == 0) { return(0); } } //设置读指针开始收到包 enc28j60Write(ERDPTL, (NextPacketPtr)); enc28j60Write(ERDPTH, (NextPacketPtr)>>8); //读取下一个数据包的指针 NextPacketPtr = enc28j60ReadOp(ENC28J60_READ_BUF_MEM, 0); NextPacketPtr |= enc28j60ReadOp(ENC28J60_READ_BUF_MEM, 0)<<8; //读取下一个数据包的长度 len = enc28j60ReadOp(ENC28J60_READ_BUF_MEM, 0); //先读回低字节 len |= enc28j60ReadOp(ENC28J60_READ_BUF_MEM, 0)<<8; //后读回高字节 len -= 4;//-CRC //读取接收状态 rxstat = enc28j60ReadOp(ENC28J60_READ_BUF_MEM, 0); rxstat |= enc28j60ReadOp(ENC28J60_READ_BUF_MEM, 0)<<8; if(len<=maxlen)//如果包长小于等于缓冲区大小,则接收包 { enc28j60ReadBuffer(len, packet);//读取数据包 {//前移接收读指针:释放缓冲区1/2 unsigned int rs,re; rs = enc28j60Read(ERXSTH); rs <<= 8; rs |= enc28j60Read(ERXSTL); re = enc28j60Read(ERXNDH); re <<= 8; re |= enc28j60Read(ERXNDL); if (NextPacketPtr - 1 < rs || NextPacketPtr - 1 > re) { enc28j60Write(ERXRDPTL, (re)); enc28j60Write(ERXRDPTH, (re)>>8); } else { enc28j60Write(ERXRDPTL, (NextPacketPtr-1)); enc28j60Write(ERXRDPTH, (NextPacketPtr-1)>>8); } } //包计数器减一:释放缓冲区2/2 enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON2, ECON2_PKTDEC); return(len);//返回包长度 } else//包长大于缓冲区长度,丢弃,但仍然要释放缓冲区 { { unsigned int rs,re; rs = enc28j60Read(ERXSTH); rs <<= 8; rs |= enc28j60Read(ERXSTL); re = enc28j60Read(ERXNDH); re <<= 8; re |= enc28j60Read(ERXNDL); if (NextPacketPtr - 1 < rs || NextPacketPtr - 1 > re) { enc28j60Write(ERXRDPTL, (re)); enc28j60Write(ERXRDPTH, (re)>>8); } else { enc28j60Write(ERXRDPTL, (NextPacketPtr-1)); enc28j60Write(ERXRDPTH, (NextPacketPtr-1)>>8); } } enc28j60WriteOp(ENC28J60_BIT_FIELD_SET, ECON2, ECON2_PKTDEC); return(0);//我们丢弃了数据包,所以返回0 } } |
|
|
|
我用的是enc28j60的芯片,没看到有ETH_RXBUFNB的定义的
|
|
|
|
刷新网页的同时串口1通信以300ms的间隔通信,这样经常会导致程序卡住,发现一直进入enc28j60的中断的,这样可以怎么解决呢?
|
|
|
|
只有小组成员才能发言,加入小组>>
如何使用STM32+nrf24l01架构把有线USB设备无线化?
2574 浏览 7 评论
请问能利用51单片机和nRF24L01模块实现实时语音无线传输吗?
2371 浏览 5 评论
3228 浏览 3 评论
2843 浏览 8 评论
为什么ucosii上移植lwip后系统进入了HardFault_Handler?
2796 浏览 4 评论
请教各位大咖:有没有接收频率32M左右的芯片推荐的?先感谢啦!
681浏览 1评论
915浏览 0评论
1039浏览 0评论
678浏览 0评论
510浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-31 02:07 , Processed in 1.309943 second(s), Total 95, Slave 79 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号