STM32H7 LAN8742 LwIP仅在加电后才能正常工作,而在复位后无法正常工作 [英] STM32H7 LAN8742 LwIP only works fine after power-up, not after reset

查看:364
本文介绍了STM32H7 LAN8742 LwIP仅在加电后才能正常工作,而在复位后无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我手头有一个奇怪的问题,以前从未见过.但是,我仍在尝试找出问题所在.我有一个STM32H753VIT和一个连接到它的LAN8742以太网控制器.我在NO-SYS模式下运行LwIP.它仅在冷启动后才能正常工作,但在硬件重置(按钮或ST-LINK探针)后无法正常工作.它运行一个简单的TCP回显服务器.如果运行,我可以对其进行ping操作,并且它会响应TCP客户端.

I have a weird problem on hand, I never saw it before. Yet, I'm still trying to pinpoint the problem. I have an STM32H753VIT and a LAN8742 ethernet controller connected to it. I run LwIP in NO-SYS mode. It only works fine after a cold power-up, but not after a hardware reset (button or ST-LINK probe). It runs a simple TCP echo server. If it runs, I can ping it, and it responds to a TCP client.

但是在硬件重置后,我不再可以对其执行ping操作,并且它不作为回显服务器进行响应.我注意到重置后,界面上的绿色(链接)LED仍将熄灭.

But after a hardware reset, I no longer can ping it, and it does not respond as an echo server. I noticed the green (link) LED on the interface will remain off after the reset.

在硬件重置后,我可以看到LAN8742_Init函数成功执行,但是在low_level_input函数中不再看到可用的RX数据.

I could see the LAN8742_Init function executes successful after a hardware reset, but it sees no longer RX data available in the function low_level_input.

在Nucleo-H743ZI上,我运行相同的代码,并且在硬件重置后也可以运行.请注意,由于引脚映射略有不同,因此代码仅稍有不同.运行良好的Nucleo-H743ZI的代码: https://github.com/bkht/Nucleo-H743ZI_LAN8742_LwIP_NO-SYS 异常行为STM32H753VIT的代码: https://github.com/bkht/STM32H753VIT_LAN8742_LwIP_NO-SYS

On a Nucleo-H743ZI, I run the same code, and this also works after a hardware reset. Note the code is only slightly different as pin mapping is slightly different. Code for well working Nucleo-H743ZI: https://github.com/bkht/Nucleo-H743ZI_LAN8742_LwIP_NO-SYS Code for strange behaving STM32H753VIT: https://github.com/bkht/STM32H753VIT_LAN8742_LwIP_NO-SYS

MCU的nRST连接到LAN8742A的nRST,并且100nF的电容器用于GND.我有一个复位开关,我尝试了一个上拉电阻,但没有运气.我添加了一个重置​​按钮,发现较长的硬件重置也不起作用.

The nRST of the MCU is connected to the nRST of the LAN8742A and a capacitor of 100nF is used to GND. I've a reset switch and I tried a Pull-up resistor, nut no luck. I have added a reset button, and this found that a longer hardware reset does not work either.

我在考虑时间或内存内容的方向.有没有人见过这种启动行为?

I'm thinking in the direction of timing, or memory contents. Has anybody ever seen such start-up behavior?

推荐答案

解决了该问题,在对LAN8942A进行软件重置的代码之后,我添加了一行以设置BCR中的自动协商位(第12位)(0x00)寄存器.

Solved, after the code that performs a software reset of the LAN8942A, I added one line to set the auto-negotiation bit (bit 12) in the BCR (0x00) register.

pObj->IO.WriteReg(pObj->DevAddr, LAN8742_BCR, LAN8742_BCR_AUTONEGO_EN);

对于那些感兴趣的人,我将在github中更新代码.

I will update the code in github, for those people interested.

这篇关于STM32H7 LAN8742 LwIP仅在加电后才能正常工作,而在复位后无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆