你好,初始化上电后,运行读取到PHY芯片ID号,状态信息如下所示。并且按照STM32官方demo配置的lwip和RTOS出现如下的情况,网线一直是接STM32板子和PC端的:
1、初始化完HAL_ETH_Init()后读取PHY芯片ID号和状态值。复位PHY芯片
[C] 纯文本查看 复制代码 hal_eth_init_status = HAL_ETH_Init(&heth);
uint32_t reg_id = 0;
HAL_ETH_ReadPHYRegister(&heth, 0x0, 0x02, ®_id);
printf("reg_id = 0x%08x\n", reg_id);
uint32_t reg_status = 0;
HAL_ETH_ReadPHYRegister(&heth, 0x0, 0x01, ®_status);
printf("reg_status = 0x%08x\n", reg_status);
结果读取:
[C] 纯文本查看 复制代码 reg_id = 0x00000243
reg_status = 0x00007849
2、读取PHY芯片的链接状态:
[C] 纯文本查看 复制代码 PHYLinkState = LAN8742_GetLinkState(&LAN8742);
printf("PHYLinkState = %d\n", PHYLinkState);
结果为:
[C] 纯文本查看 复制代码 PHYLinkState = 1
3、最后有一个创建线程出错,无法正常创建以太网连接线程
[C] 纯文本查看 复制代码 /* Create the Ethernet link handler thread */
/* USER CODE BEGIN H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
osThreadDef(EthLink, ethernet_link_thread, osPriorityNormal, 0,
configMINIMAL_STACK_SIZE * 4);
osThreadId ethThreadId = osThreadCreate(osThread(EthLink), &gnetif);
if (ethThreadId == NULL) {
printf("Thread creation failed! Possible reasons:\n");
printf("1. Insufficient heap (current heap free: %d bytes)\n",
xPortGetFreeHeapSize());
printf("2. Stack too small / priority invalid\n");
printf("3. RTOS scheduler not running?\n");
}
/* USER CODE END H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
结果为:
[C] 纯文本查看 复制代码 Thread creation failed! Possible reasons:
1. Insufficient heap (current heap free: 6880 bytes)
2. Stack too small / priority invalid
3. RTOS scheduler not running? |