You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DIRECT_MODE_INPUT(reg, mask);
...
DIRECT_WRITE_LOW(reg, mask);
...
DIRECT_MODE_OUTPUT(reg, mask); // drive output low
...
DIRECT_MODE_INPUT(reg, mask); // allow it to float
to drive the line high/low and read it.
Why cant we just set GPIO to the open_drain output (on a compatible platforms) and pull it low or release (instead of switching it from input to output and vice versa)? That would trim down unnecessary pin reconfigurations, and improve timings during read/write operations.
Also, with the original code on STM32@32MHz communication seems to be barely stable, because if I capture the line signal, logic analyzers with OneWire decoders complaining about timing issues, unknown commands etc.
I've modified the OneWire library to just write low/high on OpenDrain output, and even got a stability improvement over a timing issue on the STM32 platform. For now its able to run on 24/16 MHz instead of just >= 32 MHz, and logic analyzer still recognizes wire commands/bytes.
Seems a platforms supporting opendrain output would benefit from this change?
There is a lot of code like this
to drive the line high/low and read it.
Why cant we just set GPIO to the
open_drain
output (on a compatible platforms) and pull it low or release (instead of switching it from input to output and vice versa)? That would trim down unnecessary pin reconfigurations, and improve timings during read/write operations.Also, with the original code on STM32@32MHz communication seems to be barely stable, because if I capture the line signal, logic analyzers with OneWire decoders complaining about timing issues, unknown commands etc.
I've modified the
OneWire
library to just write low/high on OpenDrain output, and even got a stability improvement over a timing issue on theSTM32
platform. For now its able to run on 24/16 MHz instead of just >= 32 MHz, and logic analyzer still recognizes wire commands/bytes.Seems a platforms supporting opendrain output would benefit from this change?
Code changes I've made:
util\OneWire_direct_gpio.h
replaced with
OneWire.cpp
pinMode(pin, INPUT);
replaced with a
pinMode(PB3, OUTPUT_OPEN_DRAIN);
Of course just for test, normally that goes under
#ifdef
macro for corresponding architecture.The text was updated successfully, but these errors were encountered: