微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > STM32中ETH驱动配置注意事项

STM32中ETH驱动配置注意事项

时间:11-19 来源:互联网 点击:

/* 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; //接收数据超过阈值转发ETH_InitStructure.ETH_FlushReceivedFrame = ETH_FlushReceivedFrame_Enable; //描述符被占用和接收FIFO不可用时清空FIFO(解决堵塞)ETH_InitStructure.ETH_TransmitStoreForward = ETH_TransmitStoreForward_Disable; //发送数据完整帧转发ETH_InitStructure.ETH_TransmitThresholdControl = ETH_TransmitThresholdControl_64Bytes; //发送阈值为64BytesETH_InitStructure.ETH_ForwardErrorFrames = ETH_ForwardErrorFrames_Disable; //接收FIFO丢弃所有错误帧/*接收FIFO上传长度不够的好帧*/ETH_InitStructure.ETH_ForwardUndersizedGoodFrames = ETH_ForwardUndersizedGoodFrames_Enable; ETH_InitStructure.ETH_ReceiveThresholdControl = ETH_ReceiveThresholdControl_64Bytes; //接收阈值为64BytesETH_InitStructure.ETH_SecondFrameOperate = ETH_SecondFrameOperate_Enable; //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_2_1; //发送和接收比例(上传数据时重要) 2:1/* Configure Ethernet */ETH_Init(Ð_InitStructure, DP83848_PHY_ADDRESS);/* Enable the Ethernet Rx Interrupt 仅开启接收中断*/ETH_DMAITConfig(ETH_DMA_IT_NIS ETH_DMA_IT_R, ENABLE);

当然这是我根据自己需求的配置,具体项目因为实际传输的不同需要个人修改也是必要的。

3.lwip中lwipopt.h文件的修改

 参见http://www.cnblogs.com/zc110747/p/4739588.html设置

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top