完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
一步一步的硬件调试,看看是卡到哪里了?
|
|
|
|
/**
* @brief Read a PHY register * @param PHYAddress: PHY device address, is the index of one of supported 32 PHY devices. * This parameter can be one of the following values: 0,..,31 * @param PHYReg: PHY register address, is the index of one of the 32 PHY register. * This parameter can be one of the following values: * @arg PHY_BCR: Transceiver Basic Control Register * @arg PHY_BSR: Transceiver Basic Status Register * @arg PHY_SR : Transceiver Status Register * @arg More PHY register could be read depending on the used PHY * @retval ETH_ERROR: in case of timeout * MAC MIIDR register value: Data read from the selected PHY register (correct read ) */ uint16_t ETH_ReadPHYRegister(uint16_t PHYAddress, uint16_t PHYReg) { uint32_t tmpreg = 0; __IO uint32_t timeout = 0; /* Check the parameters */ assert_param(IS_ETH_PHY_ADDRESS(PHYAddress)); assert_param(IS_ETH_PHY_REG(PHYReg)); /* Get the ETHERNET MACMIIAR value */ tmpreg = ETH->MACMIIAR; /* Keep only the CSR Clock Range CR[2:0] bits value */ tmpreg &= ~MACMIIAR_CR_MASK; /* Prepare the MII address register value */ tmpreg |=(((uint32_t)PHYAddress<<11) & ETH_MACMIIAR_PA); /* Set the PHY device address */ tmpreg |=(((uint32_t)PHYReg<<6) & ETH_MACMIIAR_MR); /* Set the PHY register address */ tmpreg &= ~ETH_MACMIIAR_MW; /* Set the read mode */ tmpreg |= ETH_MACMIIAR_MB; /* Set the MII Busy bit */ /* Write the result value into the MII Address register */ ETH->MACMIIAR = tmpreg; /* Check for the Busy flag */ do { timeout++; tmpreg = ETH->MACMIIAR; } while ((tmpreg & ETH_MACMIIAR_MB) && (timeout < (uint32_t)PHY_READ_TO)); /* Return ERROR in case of timeout */ if(timeout == PHY_READ_TO) { return (uint16_t)ETH_ERROR; } /* Return data register value */ return (uint16_t)(ETH->MACMIIDR); } |
|
|
|
|
|
|
|
你下载到硬件里,然后一步步调试,按F10,看卡在哪个函数那了。就好找下一步的错误了。。
|
|
|
|
你用的什么板子,,原因有2个。。第一个是静态id 还是动态的ID,,,宏定义#define LWIP_DHCP 必须置1 第二个就是板子的硬件,,,,你用的什么网络接口,enc28j60还是其他,,,在看看spi初始化引脚配制
|
|
|
|
只有小组成员才能发言,加入小组>>
如何使用STM32+nrf24l01架构把有线USB设备无线化?
2544 浏览 7 评论
请问能利用51单片机和nRF24L01模块实现实时语音无线传输吗?
2331 浏览 5 评论
3158 浏览 3 评论
2803 浏览 8 评论
为什么ucosii上移植lwip后系统进入了HardFault_Handler?
2761 浏览 4 评论
请教各位大咖:有没有接收频率32M左右的芯片推荐的?先感谢啦!
608浏览 1评论
853浏览 0评论
968浏览 0评论
621浏览 0评论
447浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 06:03 , Processed in 1.063708 second(s), Total 56, Slave 50 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号