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

Fix UART to handle CPU/APB clock changes #808

Merged
merged 4 commits into from
Sep 21, 2023

Conversation

MabezDev
Copy link
Member

@MabezDev MabezDev commented Sep 21, 2023

For the ESP32 and ESP32-S2, baud rate can be affected by CPU speed, which was causing issues in the stub: esp-rs/esp-flasher-stub#29 ( and perhaps some esp-wifi projects?). new now takes a reference to the CPU clock and adjusts its baud calculations accordingly.

Must

  • The code compiles without errors or warnings.
  • All examples work.
  • cargo fmt was run.
  • Your changes were added to the CHANGELOG.md in the proper section.
  • You updated existing examples or added examples (if applicable).
  • Added examples are checked in CI

Nice to have

  • You add a description of your work to this PR.
  • You added proper docs for your newly added features and code.

@MabezDev MabezDev force-pushed the uart-init-clocks branch 2 times, most recently from e92d74c to 344d9d1 Compare September 21, 2023 14:27
esp-hal-common/src/lib.rs Outdated Show resolved Hide resolved
@MabezDev MabezDev marked this pull request as ready for review September 21, 2023 14:37
esp-hal-common/src/lib.rs Outdated Show resolved Hide resolved
}
use crate::gpio::*;
// not real, just to satify the type
type Pins<'a> = TxRxPins<'a, GpioPin<Output<PushPull>, 2>, GpioPin<Input<Floating>, 0>>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anyone has a better idea of how to satisfy this let me know.

Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jessebraham jessebraham merged commit eeb2d1d into esp-rs:main Sep 21, 2023
16 checks passed
SergioGasquez pushed a commit to SergioGasquez/esp-hal that referenced this pull request Sep 22, 2023
* Ensure that uart is configured to account for clock changes, not just boot defaults

* fix examples

* changelog

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
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.

4 participants