Comments (5)
Seems the problem is more related to hardware than software (is_high
function reads the register).
Have you tried to set the internal pull up resistor in place of your own (which I assume is wired as a pull up).
You can do so with pin.internal_pull_up(true)
.
That might clear some doubts about the internal circuitry potentially affecting the results.
from esp-hal.
Well, with this simple schema:
turning the internal resistor on (pin.internal_pull_up(true)
) does not change a thing.
from esp-hal.
Ok let's try something even simpler
#![no_std]
#![no_main]
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 = {}", pin1.is_high().unwrap());
println!("pin2 = {}", pin2.is_high().unwrap());
loop {}
}
This configures GPIO4 and 5 into open-drain and enables internal pull-ups. So for this test we just need to connect GPIO4 and 5.
Running this code on e.g. EPS32-C3 and ESP32-S3 prints the expected
pin1 = true
pin2 = true
Setting any of the pins to low will show low for both - as expected.
However, I can confirm it's always false on ESP32 - seems like a bug to me (on ESP32).
Thanks for bringing this up!
from esp-hal.
Related Issues (20)
- RFC: What to do about `async` vs `direct-vectoring` features? HOT 1
- Find a way to use ROM memset/memcpy - if it can't work, we should ensure memcpy and memset are in RAM somehow HOT 5
- TRNG #1200 breaks esp-wifi for ESP32-S2 HOT 1
- esp-hal 0.16.0 : Can't compile esp-wifi with the new esp-hal 0.16.0 HOT 3
- TWAI Overrun error when compiling in debug mode HOT 3
- Be explicit about the need to build using the `release` profile HOT 2
- Don’t forget to upgrade the defmt version in esp-backtrace and esp-println. HOT 1
- Automatically update the links and version numbers in the documentation index HOT 1
- Try to reduce duplicated code between `I2C`/`LP_I2C` drivers HOT 2
- Add ETM tasks and events for timers HOT 2
- The `resources/index.html` file should be converted to a template, and the packages and their versions should be populated dynamically.
- `UsbSerialJtag`s `core::fmt::Write` impl is blocking HOT 1
- Reading from ADC1 is broken once esp-wifi initialize() function has been called HOT 10
- RFC: Investigate the need for a lower-level layer of abstraction HOT 1
- Rng Initialization breaks ADC1 (at least on ESP32) HOT 4
- variant usage HOT 2
- Critical section crash HOT 6
- ESP32 & ESP32-S2: Wrong I²C frequency
- Nightly CI is broken HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.