-
Notifications
You must be signed in to change notification settings - Fork 935
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
Implement MII interface with feature flag #2465
Conversation
4d306fb
to
5a92232
Compare
very nice! instead of using Cargo features, could you make it into separate |
5a92232
to
725b367
Compare
Thank you for the quick feedback @Dirbaio 🙂 I updated the patch according to your suggestions. I also tested that it still works with my STM32H745XI discovery board. Assumptions that I made:
Questions where I would like to have your input:
|
312b313
to
ffc0033
Compare
code looks good, can you fix CI?
they come from here https://github.com/embassy-rs/embassy/blob/main/embassy-stm32/build.rs#L54 in particular rcc_h5 is active on stm32h5 chips. |
Thanks for the info @Dirbaio ! I'd like to fix the CI, but I have a hard time reproducing the issue locally. Which steps are necessary to run As far as I can tell, the issue in CI stems from the fact that I changed the public API of Here in the ethernet module, we conditionally include either the v1 or v2 version of the ethernet module implementation. In the test, I tried a few combinations and ultimately settled on this: #[cfg(not(eth_v2))]
let device = Ethernet::new(
...
);
#[cfg(eth_v2)]
let device = Ethernet::new_rmii(
...
); From the error in CI, it looks like the test code tries to use the v1 function
I imagine the problem is that the flags passed to build the test binary are different from the flags passed to build the |
CI tells you at the end
so to reproduce
|
ah yes the issue is the This reveals an inconsistency between v1 and v2 though! and consistency between versions matters. Maybe we should name v1 |
- Extend the eth/v2 module to support MII besides RMII. - Replace `Ethernet::new` with `Ethernet::new_mii` and `Ethernet::new_rmii`. - Update ethernet examples. - Add example for MII ethernet.
ffc0033
to
e613324
Compare
ended doing this. Also fixed some fun issue with PC2_C pins in stm32-data... thanks for the PR! |
The eth/v2 module of embassy-stm32 currently only supports RMII (reduced media independent interface) interfaces with 9 pins. However some chips only/better support a MII interface with 14 pins. With this PR, I want to propose adding support for MII interfaces to
embassy
.Credits to figuring this out go to my colleague @KloolK, who sat down last year and implemented the necessary changes in a commit here for an older version of
embassy
.This PR is meant as discussion basis. Introducing MII as a feature was the least noisy to show the necessary changes. However in the current setup, the features are not additive. Having separate structs for MII and RMII may be a better solution.