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

ESP32: Apply Errata 3.6 fix in more places #1315

Merged
merged 2 commits into from
Mar 20, 2024
Merged

Conversation

bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented Mar 20, 2024

Thank you for your contribution!

We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:

Submission Checklist 📝

  • I have updated existing examples or added new ones (if applicable).
  • My changes were added to the CHANGELOG.md in the proper section.

Extra:

Pull Request Details 📖

Description

In #1285 there was a problem discovered in configuring GPIO4 as open-drain. This made me find out we are not applying the errata36 fix in all places we should. Also #594 is probably pointing into that direction.

Testing

Easiest way to test this: Copy this into e.g. examples/hello_world.rs, connect GPIO 4 and 5

#![no_std]
#![no_main]

//% FEATURES: embedded-hal-02

use embedded_hal_02::digital::v2::{InputPin, OutputPin, StatefulOutputPin};
use esp_backtrace as _;
use esp_hal::{clock::ClockControl, gpio::IO, peripherals::Peripherals, prelude::*};
use esp_println::println;

#[entry]
fn main() -> ! {
    let peripherals = Peripherals::take();
    let system = peripherals.SYSTEM.split();
    let _clocks = ClockControl::boot_defaults(system.clock_control).freeze();

    let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
    let mut pin1 = io.pins.gpio4.into_open_drain_output();
    pin1.internal_pull_up(true);
    let mut pin2 = io.pins.gpio5.into_open_drain_output();
    pin2.internal_pull_up(true);

    pin1.set_high().unwrap();
    pin2.set_high().unwrap();

    println!("pin1 is set high {}", pin1.is_set_high().unwrap());
    println!("pin2 is set high {}", pin2.is_set_high().unwrap());
    println!("pin1 = {}", pin1.is_high().unwrap());
    println!("pin2 = {}", pin2.is_high().unwrap());

    loop {}
}

With the fix it prints as expected

pin1 is set high true
pin2 is set high true
pin1 = true
pin2 = true

Without the fix it looks like this

pin1 is set high true
pin2 is set high true
pin1 = false
pin2 = false

@bjoernQ bjoernQ force-pushed the more-errata-3.6-fixes branch from 3ecb438 to 2999ac1 Compare March 20, 2024 15:35
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 for the fix!

@jessebraham jessebraham added this pull request to the merge queue Mar 20, 2024
Merged via the queue into main with commit 1f155cf Mar 20, 2024
35 checks passed
@bjoernQ bjoernQ deleted the more-errata-3.6-fixes branch March 20, 2024 16:16
yanshay pushed a commit to yanshay/esp-hal that referenced this pull request Mar 20, 2024
* ESP32: Apply Errata 3.6 fix in more places

* CHANGELOG.md entry
yanshay pushed a commit to yanshay/esp-hal that referenced this pull request Mar 25, 2024
* ESP32: Apply Errata 3.6 fix in more places

* CHANGELOG.md entry
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.

2 participants