nodemcu / nodemcu-firmware

Lua based interactive firmware for ESP8266, ESP8285 and ESP32
https://nodemcu.readthedocs.io
MIT License
7.66k stars 3.12k forks source link

ow: allow pin 0 #926

Closed dvv closed 8 years ago

dvv commented 8 years ago

https://github.com/nodemcu/nodemcu-firmware/blob/dev/app/modules/ow.c#L14

The condition forbids using 1-wire on pin 0. Is it intended?

TIA

ABonner commented 8 years ago

Isn't GPIO0 used to select bootup mode (Boot from Flash or Program via UART)?

dvv commented 8 years ago

Right. But nodemcu is master and OW devices never (afaik) lower the line without master command and line is pulled up.

nickandrew commented 8 years ago

D0 is GPIO16, which has restricted functionality (no interrupts or PWM). I don't think there's any reason that the ow module as currently designed would not work with GPIO16. However, if the ow module were changed to be interrupt-driven (which I'd recommend) then D0 would become unavailable again.

Is there a need for you to run onewire on GPIO16? You're using every other GPIO already and none of those peripherals can use GPIO16?

dvv commented 8 years ago

Let us count it as a notice. +1 for interrupt-driven ow.

nickandrew commented 8 years ago

We're agreed that an interrupt-driven onewire module would be a good thing. It just needs someone to take the time to code it. And if it happens, D0 won't be usable anyway. So there's no point enabling D0 in the current module. Closing.

dvv commented 8 years ago

I wonder if UART as 1-wire driver (https://www.maximintegrated.com/en/app-notes/index.mvp/id/214) can be used for interrupt-driven onewire module?

nickandrew commented 8 years ago

@dvv I think it's feasible, so long as the hardware designer doesn't mind using 2 pins for each 1-wire bus, and specifically 2 UART pins. They also have to make an external open-drain buffer circuit to connect the ESP-xx to the onewire bus.