Skip to content
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

Export, demonstrate ENET peripheral #146

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

mciantyre
Copy link
Member

The rtic_enet_dhcp_tcp.rs example runs a DHCP client on an i.MX RT 1170EVK. Once assigned an IP address, it creates a TCP socket that loops back any data sent to it. The example demonstrates some support for smoltcp. It depends on a prototype driver, imxrt-enet, which I'm still thinking through.

The example works on my 1170EVK with my router, but there's still more to do. In particular, I can't bring the speed up to 100Mbit/s; if I try, the receive path doesn't work reliably. MIB statistics show CRC and alignment errors for receive, but transmit is fine. I'm notably not bringing up the Ethernet PLL, so next step might be to rule out clock quality issues. Until then, you're playing with a 10Mbit/s driver, enforced by a restricted PHY autonegotiation.

@mciantyre
Copy link
Member Author

I'm notably not bringing up the Ethernet PLL, so next step might be to rule out clock quality issues.

I linked with SDK code to simplify PLL1 bringup, remuxed ENET clocks, forced a 100Mbit/s PHY autonegotation, and disabled the 10Mbit/s driver config. There's no more CRC or alignment errors in the receive path, and the example works as expected.

Looks like it's time for the inevitable: make the 1170 clocks useful. What's this analog IP interface thing...?

@mciantyre
Copy link
Member Author

A single setpoint also works for PLL1 bring-up, with no analog IP interface needed. The MAC and PHY are up to 100Mbit/s.

mciantyre and others added 8 commits October 27, 2024 13:11
This provides important signal: imxrt-enet builds without issue for all
of these MCUs. That doesn't necessarily means it works, but it's nice
when the peripheral blocks are consistent across the MCUs.
It's the ENET instance that does not support 1Gbit operation. The PHY
reset and configuration is hard-coded into the board module, and it's
fixing the PHY for 10Mbit/s operation. If I go faster, the receive
pathway doesn't work (but the transmit pathway seems fine). One thing
I'd like to rule out is the clock quality; bringing up the ENET PLL is a
TODO.
Works on my hardware (1170EVK, and a Netgear R7000 router w/ stock
firmware).  Note that I'm throttling the ENET's receive speed to
10Mbit/s, full-duplex; see previous commit for more info.
Enable the PLL_LDO in all setpoints, and enable PLL1 in setpoint 1.
Since I'm only using setpoints for PLL_LDO and PLL1 bring-up, I'm
implementing the rest of the GPC state machine in software (specifically
for the ENET clocks). This seems sufficient for enabling PLL1 and
getting a clean 50MHz ENET reference clock. I can increase the ENET
transfer speeds in the MAC and PHY.

The GPC, PMU, and CCM APIs are a bare-minimal. They should be introduced
in a separate commit / PR. But they're good enough for prototyping.
Monitor your board's serial log for the IP address it's assigned. Then,
pass it into this command-line tool to make sure you can connect, send a
message, and receive the response.
Use the constant enum to change the example's behavior. This commit also
allows the TCP socket to be re-used after the client disconnects. Each
example works in debug and release builds (though I needed a separate
fix in the ENET driver due to a poorly-written debug assert).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant