-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open Drain outputs don't work (also breaks bitbangio.I2C) #3845
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
Comments
Maybe we aren't correctly supporting open drain outputs in the |
I tested with |
I wired up a couple of LEDs and can confirm that open drain doesn't work, or at least not as I expect it. In push/pull mode, one LED lights brightly depending whether the pin's value is True or False. In open drain mode, neither LED lights no matter whether the value is True or False. However, the upper LED should light when value is False. I did verify that in input mode, pull up/down/none all work; the pulls can be seen as a dimly lighting LED. |
Simple fix for this, which I am doing as part of #5816: @@ -108,11 +108,9 @@ digitalinout_result_t common_hal_digitalio_digitalinout_set_drive_mode(
digitalio_digitalinout_obj_t *self,
digitalio_drive_mode_t drive_mode) {
gpio_num_t number = self->pin->number;
- gpio_mode_t mode;
+ gpio_mode_t mode = GPIO_MODE_DEF_OUTPUT;
if (drive_mode == DRIVE_MODE_OPEN_DRAIN) {
- mode = GPIO_MODE_DEF_OD;
- } else {
- mode = GPIO_MODE_DEF_OUTPUT;
+ mode |= GPIO_MODE_DEF_OD;
}
esp_err_t result = gpio_set_direction(number, mode);
if (result != ESP_OK) { |
On the Kaluga, I have two sensors attached to the I2C bus at IO10/11. They are detected if I scan with busio.I2C but not with bitbangio.I2C. When I scope bitbangio, there is literally no activity on the pins 10/11; there is the expected activity with busio.I2C.
I'm testing a local build. Possibly important, this is a
DEBUG=1
build.The text was updated successfully, but these errors were encountered: