10875|1

21

帖子

0

TA的资源

一粒金砂(高级)

楼主
 

CP2201问题 [复制链接]

各位好 我用8051和CP2201做了个以太网接口 在CP2201物理层初始化过程中 不管有没有连接 INT1RD的值总为0X31 不知道问题出在什么地方 希望高手能指点下 初始化程序如下 unsigned char PHY_Init() { unsigned char temp_char; unsigned char retval = 0; //-------------------------------------------------------------------------- // Auto-Negotiation Synchronization (Section 15.2 of CP220x Datasheet) //-------------------------------------------------------------------------- // Step 1: Disable the PHY PHYCN = 0x00; // Step 2: Enable the PHY with link integrity test and auto-negotiation // turned off // A. Disable the Transmitter Power Save Option and Configure Options TXPWR = 0x80; PHYCF = ( SMSQ | JABBER | ADPAUSE | AUTOPOL ); // B. Enable the Physical Layer PHYCN = PHYEN; Delay1ms(200); Delay1ms(200); Delay1ms(200); // C. Wait for the physical layer to power up // wait_ms(10); // D. Enable the Transmitter and Receiver PHYCN = ( PHYEN | PHYTXEN | PHYRXEN ); // Step 3: Poll the Wake-on-Lan Interrupt Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); // A. Clear Interrupt Flags temp_char = INT1; // B. Start a new timeout for 1.5 seconds // reset_timeout(ONE_SECOND+ONE_SECOND/2); // C. Check for a signal // If no signal is deteced, wait 1.5s, then continue // if(timeout_expired()){ // break; // } //-------------------------------------------------------------------------- // Physical Layer Initialization (Section 15.7 of CP220x Datasheet) //-------------------------------------------------------------------------- // Step 1: Synchronization procedure implemented above // Step 2: Disable the physical layer PHYCN = 0x00; // Step 3: Configure the desired physical layer options including // auto-negotiation and link integrity PHYCF = ( SMSQ | LINKINTG | JABBER | AUTONEG | ADPAUSE | AUTOPOL ); // Step 4: Enable the physcial layer // A. Enable the Physical Layer PHYCN = PHYEN; Delay1ms(200); Delay1ms(200); Delay1ms(200); // B. Wait for the physical layer to power up // wait_ms(10); // C. Enable the Transmitter and Receiver // Auto-negotiation begins now PHYCN = ( PHYEN | PHYTXEN | PHYRXEN ); // Step 5: Wait for auto-negotiation to complete // Clear INT1 Interrupt Flags temp_char = INT1; Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); Delay1ms(200); // Delay1ms(200); // Start a six second timeout // reset_timeout(6*ONE_SECOND); // Check for autonegotiation fail or complete flag while(1){ // If Auto-Negotiation Completes/Fails, break if(INT1RD & (ANCINT | ANFINT)){ printf ("\nINT0RD=%.2x \n",(unsigned int)INT0RD); printf ("\nINT1RD=%.2x \n",(unsigned int)INT1RD); printf ("\nINT1RD=%.2x \n",(unsigned int)INT1RD); break; } } // Mask out all bits except for auto negotiation bits temp_char = INT1RD; temp_char &= (ANCINT | ANFINT); // Check if Auto-Negotiation has FAILED if(temp_char & ANFINT){ // Auto-Negotiation has failed retval = LINK_ERROR; } else // Check if Auto-Negotiation has PASSED if(temp_char == ANCINT){ // Auto-Negotiation has passed retval = 0; // Enable Link LED and Activity LED // IOPWR = 0x0C; } else // Timeout Occured. { // Timeout retval = LINK_ERROR; } return retval; }
此帖出自单片机论坛

最新回复

不好意思 没做过这个 帮不上忙了  详情 回复 发表于 2007-11-22 19:06
点赞 关注
 

回复
举报

1759

帖子

0

TA的资源

裸片初长成(高级)

沙发
 

回复:CP2201问题

不好意思 没做过这个 帮不上忙了
此帖出自单片机论坛
 
个人签名南京璞晓电子   www.cpx0.com需要
msn:njlianjian@hotmail.com
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/7 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表