feat(emac): add Synopsys DWC Ethernet MAC driver for CH32V307#157
Open
ArthurHeymans wants to merge 1 commit intoch32-rs:mainfrom
Open
feat(emac): add Synopsys DWC Ethernet MAC driver for CH32V307#157ArthurHeymans wants to merge 1 commit intoch32-rs:mainfrom
ArthurHeymans wants to merge 1 commit intoch32-rs:mainfrom
Conversation
Add an EMAC driver for the CH32V307's Synopsys DesignWare Ethernet MAC, supporting both the built-in 10M PHY and external PHYs via RMII/MII. The driver implements embassy_net_driver::Driver with DMA descriptor rings (chained mode), SMI/MDIO PHY management, and async TX/RX via interrupt-driven wakeups. For the built-in 10M PHY (PhyInterface::Internal10M): - Configures PLL3 to 60MHz as the PHY clock source - Enables the PHY via EXTEND.CTR.ETH_10M_EN - Sets MACCR.IRE for 50-ohm impedance matching - Writes PHY_MDIX register (0x1E) for auto PN polarity detection - Enables promiscuous mode for PHY polarity detection Includes a TCP echo server example (examples/ch32v307/src/bin/eth.rs) that initializes the 10M PHY, obtains an IP via DHCP, and echoes TCP data on port 1234. Tested on hardware with ping and TCP. Depends on EMAC register definitions from ArthurHeymans/ch32-data, generated into ArthurHeymans/ch32-metapac (rev b079130). The ch32-metapac dependency is temporarily pointed at this fork until the register definitions are upstreamed to ch32-rs/ch32-data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add an EMAC driver for the CH32V307's Synopsys DesignWare Ethernet MAC,
supporting both the built-in 10M PHY and external PHYs via RMII/MII.
The driver implements embassy_net_driver::Driver with DMA descriptor
rings (chained mode), SMI/MDIO PHY management, and async TX/RX via
interrupt-driven wakeups.
For the built-in 10M PHY (PhyInterface::Internal10M):
Includes a TCP echo server example (examples/ch32v307/src/bin/eth.rs)
that initializes the 10M PHY, obtains an IP via DHCP, and echoes TCP
data on port 1234. Tested on hardware with ping and TCP.
Depends on EMAC register definitions from ArthurHeymans/ch32-data,
generated into ArthurHeymans/ch32-metapac (rev b079130). The
ch32-metapac dependency is temporarily pointed at this fork until the
register definitions are upstreamed to ch32-rs/ch32-data.
ch32-rs/ch32-data#27 is the PR for the ch32-data update.