-
Notifications
You must be signed in to change notification settings - Fork 7.5k
mimxrt1050_evb board: Can't get Ethernet to work #11586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As additional info, I tried to vary different things. At one point e1000e device was actually hosed, so switching back to frdm_k64f it didn't work, and there was a weird error in dmesg. That caused me some confusion, but after rebooting the laptop, I have a clear reproducible picture that connected frdm_k64f works, while mimxrt1050_evb - doesn't. |
I tried another Eth cable too ;-). |
Hello @pfalcon I'm using a VM to develop and test. I have a USB-Ethernet adapter that is assigned to the VM as eth1 (eth0 - NAT to host). I'm using the adapter to connect the board to the VM. |
@agansari: Thanks for the info and confirmation, looking towards a fix,
Note that dumb_http_server doesn't access Internet in any way, so DNS or NAT should not be needed. dumb_http_server is well, a simple web server. If everything runs ok, you can just access it from a desktop browser using http://192.0.2.1:8080/ . I use Apache Bench (ab) tool on Linux, because I usually test that a big number of HTTP requests can be handled without anything go wrong (e.g. 1000 requests in row). |
Hello, today I made a rebase on the latest firmware and ethernet works as expected, initilization goes okay, leds blink as they should and also ran the benchmark:
Can you have a go @pfalcon ? Latest commit I tested on is: 2d6a226 |
@agansari: Thanks for the update and detailed info. Not sure I'll get to it today, but will test it, thanks for the exact rev to use, to be on the same line. |
@agansari: I'm afraid it also does not work for me. I based on commit 2d6a226, built the dumb_http_server and there is no Ethernet activity, both leds are permanently on, no blinking. It does not generate any response to ARP broadcasts for its IP address. After some dubugging it seems that ENET_ReceiveIRQHandler() is never called from eth_mcux_dispacher_isr() in drivers/ethernet/eth_mcux.c, although when I ping out, ENET_TransmitIRQHandler() is called, so it looks as if the common EMAC interrupt is set up OK but not being activated for received frames. Not sure where to go from here, finding it a bit difficult to fully understand the code. I have confirmed that the hardware is OK by loading a MCUXPresso UDP echo server demo project which works fine. |
@jeremy-e-mills have you cleaned the build folder workspace after rebase? Sounds like the old behavior. cd ~/zephyr/samples/net/sockets/dumb_http_server/build Works on my setup, if there are more issues, there maybe something with my setup. |
@agansari: Yes, I cloned a fresh repository and also am building out of the zephyr tree as am using Eclipse for debug builds. I have deleted my build directories a few times and started again during the investigation. The same behaviour is observed with normal and Eclipse project builds, running XIP from hyperflash and SRAM. If it's my setup then I'm currently out of ideas. The samples run fine on the K64 board. |
@jeremy-e-mills I only tested with code in TCM memory, don't think XIP works at all. Does your code reach: mimxrt1050_evk_init() ? |
@agansari: Yes, it does and I have stepped through the pinmux set up for the EMAC connections. Sorry, should not perhaps have confused things by mentioning XIP. When I want this I cheat by building for XIP in hyperflash with a 0x2000 text section offset. I then replace the first 0x2000 bytes with the contents of another file containing an XIP header binary file that I created by stripping the first 0x2000 bytes from an XIP MCUXPresso project. |
@jeremy-e-mills: Just wanted to mention that I find your comments insightful, thanks for mentioned XIP and otherwise giving detailed info on steps you take. I'll try to join the debugging fun as soon as I can, feel a bit tired today, but hope to get to it tomorrow. |
@pfalcon: Hi, glad to have someone else looking into this. I should have contributed earlier but have been a bit reluctant as I'm a newbie to zephyr. |
Ok, tested this now, and get the same picture as I described above: my laptop's Ethernet link active LED doesn't light up, i.e. it doesn't think there's a connection carrier. @jeremy-e-mills : What about you in this case? Can you confirm that the peer sees cable connection between itself and the board? And can you describe your test setup? |
So, what I'm doing is testing using samples/net/echo_server with ipv6 disabled. I then enabled:
And I saw log output below. And then suddenly I noticed that link LED on laptop is up! Still no pings though.
|
Btw, this is the output I get:
I would imagine there's a timing source bug somewhere, can you look into that, @agansari ? |
@agansari : Btw, this else-if ladder doesn't look too right to me, what if there're multiple interrupts to serve, why make it call ISR again instead of serving all in one go?
|
I confirm that I see this behavior too. |
And I confirm that I see ARP request from imx in wireshark on the host side, but of imx doesn't see the reply back:
|
So, link status goes up and down erratically for me - during startup of new debugging session, and not too often. For example, just got it down and can't recover so far. |
Was able to recover. So again, just works erratically w/o too clear pattern. |
The problem is with the PHY setup. I disabled the PHY reset in mimxrt1050_evk_init() and re-built. I then flashed into hyperflash a working Ethernet MCUXPresso project, confirmed LED activity and that it responded to pings. I then debugged the echo server sample project (which now no longer resets the PHY at start). The Ethernet now functions correctly, led activity ARP responses OK etc. So, two things:- @agansari: Why do you set GPI01.10 to be an output in mimxrt1050_evk_init()? It's the INTRP output from the PHY. |
@jeremy-e-mills Let me understand, you dont pull the reset now and the PHY will work if it was previously correctly enabled by another firmware? If you run a demo that does not enable PHY before running sample project, does it still work? |
@pfalcon yes that isn't the behavior i'm observing, unless there's an actual Rx packet i don't see any led activity, also it's in sync with the networking adapter's leds. |
I'm not sure if this is useful but in NuttX I saw an issue with early IMXRT1050 boards where the phy goes into NANDTree mode. On the EVKA It can be set by pin strapping on pin 21 of the PHY and there are configuration resistors to set the default config (Pg 10 of the circuit diagram). Where it gets odd is that R152 (To Gnd) and R309 (To ENET_3V3) are both provisioned on my board, so unless I'm misunderstanding something pin 21 will be at (ENET_3V3 / 2) during boot - sometimes it'll come up in NANDTree, sometimes sensibly. That would mean the problem could be fixed by removing R152 (which should have been DNP, but it is on the board), but a soft fix is more portable...just make sure the NANDTree bit is clear in the PHY config. |
@mubes I have not observed this on EVKB boards, there were some power issues in EVKA boards and revision 0 of the chip (see https://www.nxp.com/docs/en/nxp/application-notes/AN12146.pdf).
|
Ok, testing with pristine master 26c9c74 . The situation is the same - TX packets from board seen in Wireshark, but the board itself doesn't see RX. |
With #12465, situation ain't much better: #12465 (comment) |
Now going into "random poking" mode:
@agansari, Remember me complaining that I always get weird ~5Hz blinking of Eth jack's orange LED? if I change that to:
|
@agansari, @jeremy-e-mills: I wonder if we can approach this mystery in the following manner: Can you send me a know working binary with Ethernet support built for another RTOS (as mentioned above by @jeremy-e-mills), so I can try it on my board? |
1/3 bright LEDs is NANDTree mode, so sounds like this is a red herring, sorry. However, you can just check the state of the NANDTree bit in the Operation Mode Strap Override Register (Reg 16 bit 5) and reset it if needed...here is the patch that was made in NuttX for this case;
|
@mubes I' have tried to remove R152 as you suggested here on my EVKA (Rev A5) board, but this does not solve the issue. The LEDS remains in the same status, and the board is able to Tx but not Rx (confirmed with wireshark). I also have tried the PR #12465 (the last commit should prevent NAND-Tree), with no better success. With this PR, the link does not even come up! |
@AntoineZen did you get the latest push? You may have gotten the first commit that did not work. |
Yes, I've force pushed after testing the patch :) Thank you for testing. |
To avoid any possibilities, tried following patch:
Prints 0. But I noticed that @mubes code above reads and write the same reg, while @agansari you read STATUS, write OVERRIDE. Is it intended? |
@pfalcon both should work fine, OVERRIDE is also RW, STATUS is RO, did you check it out reading OVERRIDE? Status 0 means it's not the case on your side, you can also try to write without the if statement. Also I see an issue if board is powered up and phy's not yet stabilized, ETH may not work. Resetting the board makes it work because phy was stable for long enough. Attached a bare-metal example binary. |
I did.
I did, per the patch above.
If you mean resetting by Reset button, I did.
Thanks! Will look into it a bit later. |
@pfalcon are you still seeing this issue? |
@MaureenHelm, well, yeah, nothing changes on my side. I actually didn't look into it lately, was preempted with "make sockets work on a real-world 3rd-party app" work. |
@pfalcon any update on this? |
Ok, so we got together with @agansari at Linaro Connect to look into that. After we made sure that we have all the hardware setup (jumpers, etc.) and Zephyr version, the same, and after I upgraded to the latest west tool, it worked out for me. We do noted that there's a chance that Eth bootstrap might fail on startup, but I definitely had it working. Thanks for patience here. |
Describe the bug
This is continuation of the discussion at (merged/closed) #10875 (comment) .
I cannot get Ethernet connection to BOARD=mimxrt1050_evb. When I connect a patchcord between the mimxrt1050_evb and my laptop, I don't get "link active" LED light up on my laptop side, i.e. it behaves as if the cable wasn't connected. Of course, network interface in Linux doesn't have "RUNNING" status in ifconfig. As discussed at the link above, on mimxrt1050_evb, both Etherjack LEDs are lighted up, and never blink.
This same setup works as expected with frdm_k64f. I.e. if I just switch mimxrt1050_evb with frdm_k64f, leaving the same USB and Ethernet cables, it works, switching back it doesn't, again frdm_k64f - works, back to mimxrt1050_evb - doesn't.
To Reproduce
I'm using dumb_http_server as a reference sample to run.
Environment (please complete the following information):
My laptop is Thinkpad X230, with e1000e driver for Ethernet, Ubuntu 18.04:
@agansari, Can you please describe you test setup in detail, i.e. what is connected where, etc.
The text was updated successfully, but these errors were encountered: