-
Notifications
You must be signed in to change notification settings - Fork 1
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
[outdated] Add support for ENC424J600 with bumped minimq #154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see comments in-line
.github/workflows/ci.yml
Outdated
@@ -43,7 +43,7 @@ jobs: | |||
with: | |||
command: clippy | |||
|
|||
compile: | |||
compile-w5500: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the matrix strategy to compile with both the w5500
feature and the enc424j600
instead of duplicating the pipeline
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All we have to do is update the artifact names of the generated firmware images. E.g. move target/thumbv7em-none-eabihf/booster
after the W5500 build to booster-w5500
or something similar. There's no need to make separate binaries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! Please see my comments below. Some main points to do:
- Determine if our ENC424J600 driver has unnecessary operations (e.g. delays in ns, looping during NAL's connect attempt, etc)
- Determine if certain issues can be done by pushing PR to minimq (e.g. regarding error-handling after read/write)
- Verify control of TX/RX buffers
.github/workflows/ci.yml
Outdated
@@ -43,7 +43,7 @@ jobs: | |||
with: | |||
command: clippy | |||
|
|||
compile: | |||
compile-w5500: |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
(afdab5f) cargo: include enc424j600 dependencies (39e0b55) main: feature gate different eth device (e845f56) nal: implement enc424j600 variant (befe70a) nal: fix unnecessary w5500 dependencies (20efdcc) settings: override eeprom MAC (0d90470) use cargo fmt (6e13f4f) cargo: add w5500 as default (83380a9) cargo: simplify smoltcp dependency (83109c3) settings/mac: remove redundant code (a3db62f) mac: use smoltcp (15f0964) eth_cfg: split off from main (4ae6e82) nal: migrated to enc424j600 (e66d916) phy_config: minor fix (3869217) clean up
* This also tells the ENC424J600 driver to use Cortex-M instructions to perform SPI CS_n delays at the current firmware CPU clock frequency.
3b97ec4
to
be8f747
Compare
Hi @ryan-summers, I've rewritten most of my original PR commits to make the code more understandable and take advantage of all our other libraries under https://github.com/quartiq. Here are some major differences from my previous request for review: Bumping minimq to quartiq/minimq@d2ec3e8
Switching to smoltcp-nal 0.1.0
Bumping enc424j600 to latest master
Implementing mutex for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one main design discussion I'd like to resolve before moving forward. See below
* mqtt_control: Also fix missing feature gate for W5500
24f431c
to
88930f4
Compare
Dear all, I've edited my code up to commit 88930f4. I ran a Booster with this firmware for over 27 hours and there were no unexpected errors or panics during normal operation (i.e. no disconnection from MQTT broker during the test). However, the "unresolved issues" in #154 (comment) are still relevant, and I don't think those should be addressed within this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking very good - thanks for the work on this front. I agree that we should eventually update smoltcp-nal, minimq, and jump over to miniconf, but that work should definitely be reserved for a future PR.
Just a few minor comments so far.
src/main.rs
Outdated
#[cfg(feature = "phy_enc424j600")] | ||
type Ethernet = NetworkStack<'static, 'static, enc424j600::smoltcp_phy::SmoltcpDevice<Enc424j600>>; | ||
#[cfg(feature = "phy_enc424j600")] | ||
type NalClock = enc424j600_api::EpochClock<168_000_000>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should perform some type of run-time check to verify that the template argument here matches the configured CPU clock - otherwise, if we update the CPU clock speed, we may miss this and timing would go haywire.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Ryan, I tried to implement a check by declaring the CPU frequency as a global const (CPU_FREQ
), using this const as the const generic parameter for the EpochClock
(e8bd495), and additionally asserting the equality between CPU_FREQ
and the const generic param when instantiating the EpochClock
with new()
(373f6b8).
As the CPU frequency is also used elsewhere (e.g. instantiating the ENC driver, defining current task scheduled intervals), CPU_FREQ
should by extension be used for instantiating those objects too. However, I can't see a useful means to verify the frequencies during run-time for those.
If there is no other obvious mistakes or oversight, and since this has been tested for numerous times, I would greatly appreciate if this PR receives an approval soon. Since I have also tested a workaround for the fan controller I2C issue (#140), as soon as this is merged, I would like to make the corresponding PR to be rebased on this merge. Thank you! |
Much apologies!! I made a big mistake where I pushed my local |
Dear @jordens, @ryan-summers and all, I am sorry about this mistake. I wanted to merge my local According to my own local repo clone, the original To continue the discussion on this PR, I have opened a new PR on #156. I have learnt my lesson and I'd like to sincerely apologise to all parties involved. |
I don't see any issues with the git history - thanks for reverting the issue. My local history aligns with the fetched history, which indicates that the unintended change appears to be reverted properly. In general, I don't think there was any significant error on your side (this is a very understandable error to make). I'll setup branch protections to help ensure these issues don't happen in the future :) |
Summary
This PR is continued from #134 to properly implement support for the ENC424J600 controller, requiring updated crates of the
enc424j600
driver (see PRs #7 and #11) andminimq
(see diff).Key Changes
phy_enc424j600
for implementing MQTT client functionality with ENC424J600 controllerminimq
to quartiq/minimq@d2ec3e8(New changes since 6b82f96)
Testing
Network connection and MQTT features remain functional for both ENC424J600 variant on v1.4 User IFC board and W5500 variant on v1.3 User IFC board (using default crate features).
Unresolved issues (new since 6b82f96)
close()
), meaning in#[telemetry]
the MQTT client will keep callingpublish()
to queue in the socket TX buffer until it is full, and keep emittingWriteFail
errors.