|
发表于 2019-12-25 16:37:52
|
显示全部楼层
- {
- /* ETH板卡 PHY (LAN8720A) Reset管脚配置,及复位操作. */
- uint32_t tick;
- GPIO_InitTypeDef GPIO_InitStruct = {0};
-
- __HAL_RCC_GPIOB_CLK_ENABLE();
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Pin = GPIO_PIN_9;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
- HAL_GPIO_WritePin(GPIOB, GPIO_PIN_9, GPIO_PIN_RESET);
- tick = HAL_GetTick();
- do {
- } while ((HAL_GetTick() - tick) < 2);
-
- HAL_GPIO_WritePin(GPIOB, GPIO_PIN_9, GPIO_PIN_SET);
-
- tick = HAL_GetTick();
- do {
- } while ((HAL_GetTick() - tick) < 2);
-
- }
- /* Check Device Identification. */
- PHY.reg_rd(ETH_PHY_ADDR, REG_PHYIDR1, &val);
- if (val != PHY_ID1)
- {
- /* Invalid PHY ID */
- return ARM_DRIVER_ERROR_UNSUPPORTED;
- }
复制代码 |
|